diff --git a/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift b/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift index 9ec960bc4..bd46f265e 100644 --- a/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift +++ b/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift @@ -92,7 +92,7 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol { case .always: false case .privateOnly: - roomProxy.infoPublisher.value.isPublic + !roomProxy.infoPublisher.value.isPrivate case .never: true } @@ -538,7 +538,7 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol { case .privateOnly: guard let self else { return Just(false).eraseToAnyPublisher() } return roomProxy.infoPublisher - .map(\.isPublic) + .map { !$0.isPrivate } .removeDuplicates() .receive(on: DispatchQueue.main) .eraseToAnyPublisher() diff --git a/ElementX/Sources/Services/Room/RoomInfoProxy.swift b/ElementX/Sources/Services/Room/RoomInfoProxy.swift index 89fb1e935..d45b7019c 100644 --- a/ElementX/Sources/Services/Room/RoomInfoProxy.swift +++ b/ElementX/Sources/Services/Room/RoomInfoProxy.swift @@ -49,6 +49,17 @@ struct RoomInfoProxy: BaseRoomInfoProxyProtocol { var isDirect: Bool { roomInfo.isDirect } var isPublic: Bool { roomInfo.isPublic } + + // A room might be non public but also not private given the fact that the join rule might be missing or unsupported. + var isPrivate: Bool { + switch roomInfo.joinRule { + case .invite, .knock, .restricted, .knockRestricted: + true + default: + false + } + } + var isSpace: Bool { roomInfo.isSpace } var isTombstoned: Bool { roomInfo.isTombstoned } var isFavourite: Bool { roomInfo.isFavourite }