diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index b205d5aed..731ba02a6 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -83,8 +83,6 @@ class ClientProxy: ClientProxyProtocol { .asCurrentValuePublisher() } - private let roomListServiceStateSubject = CurrentValueSubject(.initial) - private var cancellables = Set() /// Will be `true` whilst the app cleans up and forces a logout. Prevents the sync service from restarting @@ -735,7 +733,6 @@ class ClientProxy: ClientProxyProtocol { shouldPrefixSenderName: true) roomSummaryProvider = RoomSummaryProvider(roomListService: roomListService, - roomListServiceStatePublisher: roomListServiceStateSubject.asCurrentValuePublisher(), eventStringBuilder: eventStringBuilder, name: "AllRooms", shouldUpdateVisibleRange: true, @@ -744,7 +741,6 @@ class ClientProxy: ClientProxyProtocol { try await roomSummaryProvider?.setRoomList(roomListService.allRooms()) alternateRoomSummaryProvider = RoomSummaryProvider(roomListService: roomListService, - roomListServiceStatePublisher: roomListServiceStateSubject.asCurrentValuePublisher(), eventStringBuilder: eventStringBuilder, name: "MessageForwarding", notificationSettings: notificationSettings, @@ -784,8 +780,6 @@ class ClientProxy: ClientProxyProtocol { MXLog.info("Received room list update: \(state)") - roomListServiceStateSubject.send(state) - guard state != .error, state != .terminated else { // The sync service is responsible of handling error and termination diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift index 82475481a..0d9921a70 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift @@ -11,7 +11,6 @@ import MatrixRustSDK class RoomSummaryProvider: RoomSummaryProviderProtocol { private let roomListService: RoomListServiceProtocol - private let roomListServiceStatePublisher: CurrentValuePublisher private let eventStringBuilder: RoomEventStringBuilder private let name: String private let shouldUpdateVisibleRange: Bool @@ -57,14 +56,12 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol { /// to the room list service through the `applyInput(input: .viewport(ranges` api. Only useful for /// lists that need to update the visible range on Sliding Sync init(roomListService: RoomListServiceProtocol, - roomListServiceStatePublisher: CurrentValuePublisher, eventStringBuilder: RoomEventStringBuilder, name: String, shouldUpdateVisibleRange: Bool = false, notificationSettings: NotificationSettingsProxyProtocol, appSettings: AppSettings) { self.roomListService = roomListService - self.roomListServiceStatePublisher = roomListServiceStatePublisher serialDispatchQueue = DispatchQueue(label: "io.element.elementx.roomsummaryprovider", qos: .default) self.eventStringBuilder = eventStringBuilder self.name = name @@ -77,16 +74,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol { .sink { [weak self] in self?.updateRoomsWithDiffs($0) } .store(in: &cancellables) - roomListServiceStateCancellable = roomListServiceStatePublisher - .receive(on: DispatchQueue.main) - .sink { [weak self] state in - guard let self else { return } - - if state == .running { - setupVisibleRangeObservers() - roomListServiceStateCancellable = nil - } - } + setupVisibleRangeObservers() setupNotificationSettingsSubscription() }