mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Make the RoomInfo isPrivate field optional and handle it accordingly.
This commit is contained in:
committed by
Stefan Ceriu
parent
11c7d07e76
commit
bfd97cd560
@@ -364,7 +364,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
return
|
||||
}
|
||||
|
||||
if !roomProxy.infoPublisher.value.isPrivate {
|
||||
if !(roomProxy.infoPublisher.value.isPrivate ?? true) {
|
||||
state.bindings.leaveRoomAlertItem = LeaveRoomAlertItem(roomID: roomID, isDM: roomProxy.isDirectOneToOneRoom, state: .public)
|
||||
} else {
|
||||
state.bindings.leaveRoomAlertItem = if roomProxy.infoPublisher.value.joinedMembersCount > 1 {
|
||||
|
||||
@@ -125,7 +125,7 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
}
|
||||
state.bindings.leaveRoomAlertItem = LeaveRoomAlertItem(roomID: roomProxy.id,
|
||||
isDM: roomProxy.isDirectOneToOneRoom,
|
||||
state: roomProxy.infoPublisher.value.isPrivate ? .private : .public)
|
||||
state: roomProxy.infoPublisher.value.isPrivate ?? true ? .private : .public)
|
||||
case .confirmLeave:
|
||||
Task { await leaveRoom() }
|
||||
case .processTapIgnore:
|
||||
|
||||
@@ -92,7 +92,7 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
|
||||
case .always:
|
||||
false
|
||||
case .privateOnly:
|
||||
!roomProxy.infoPublisher.value.isPrivate
|
||||
!(roomProxy.infoPublisher.value.isPrivate ?? true)
|
||||
case .never:
|
||||
true
|
||||
}
|
||||
@@ -524,7 +524,7 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
|
||||
case .privateOnly:
|
||||
guard let self else { return Just(false).eraseToAnyPublisher() }
|
||||
return roomProxy.infoPublisher
|
||||
.map { !$0.isPrivate }
|
||||
.map { !($0.isPrivate ?? false) }
|
||||
.removeDuplicates()
|
||||
.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user