mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Stop delaying subscriptions until after startup (#3294)
- reverts b43797f4bf0a7c20f44ae488ad47da333a7963a5 - relies on https://github.com/matrix-org/matrix-rust-sdk/pull/3981
This commit is contained in:
parent
63a0a99dbd
commit
9b6470d1f3
@ -83,8 +83,6 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
.asCurrentValuePublisher()
|
.asCurrentValuePublisher()
|
||||||
}
|
}
|
||||||
|
|
||||||
private let roomListServiceStateSubject = CurrentValueSubject<RoomListServiceState, Never>(.initial)
|
|
||||||
|
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
/// Will be `true` whilst the app cleans up and forces a logout. Prevents the sync service from restarting
|
/// 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)
|
shouldPrefixSenderName: true)
|
||||||
|
|
||||||
roomSummaryProvider = RoomSummaryProvider(roomListService: roomListService,
|
roomSummaryProvider = RoomSummaryProvider(roomListService: roomListService,
|
||||||
roomListServiceStatePublisher: roomListServiceStateSubject.asCurrentValuePublisher(),
|
|
||||||
eventStringBuilder: eventStringBuilder,
|
eventStringBuilder: eventStringBuilder,
|
||||||
name: "AllRooms",
|
name: "AllRooms",
|
||||||
shouldUpdateVisibleRange: true,
|
shouldUpdateVisibleRange: true,
|
||||||
@ -744,7 +741,6 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
try await roomSummaryProvider?.setRoomList(roomListService.allRooms())
|
try await roomSummaryProvider?.setRoomList(roomListService.allRooms())
|
||||||
|
|
||||||
alternateRoomSummaryProvider = RoomSummaryProvider(roomListService: roomListService,
|
alternateRoomSummaryProvider = RoomSummaryProvider(roomListService: roomListService,
|
||||||
roomListServiceStatePublisher: roomListServiceStateSubject.asCurrentValuePublisher(),
|
|
||||||
eventStringBuilder: eventStringBuilder,
|
eventStringBuilder: eventStringBuilder,
|
||||||
name: "MessageForwarding",
|
name: "MessageForwarding",
|
||||||
notificationSettings: notificationSettings,
|
notificationSettings: notificationSettings,
|
||||||
@ -784,8 +780,6 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
|
|
||||||
MXLog.info("Received room list update: \(state)")
|
MXLog.info("Received room list update: \(state)")
|
||||||
|
|
||||||
roomListServiceStateSubject.send(state)
|
|
||||||
|
|
||||||
guard state != .error,
|
guard state != .error,
|
||||||
state != .terminated else {
|
state != .terminated else {
|
||||||
// The sync service is responsible of handling error and termination
|
// The sync service is responsible of handling error and termination
|
||||||
|
@ -11,7 +11,6 @@ import MatrixRustSDK
|
|||||||
|
|
||||||
class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||||
private let roomListService: RoomListServiceProtocol
|
private let roomListService: RoomListServiceProtocol
|
||||||
private let roomListServiceStatePublisher: CurrentValuePublisher<RoomListServiceState, Never>
|
|
||||||
private let eventStringBuilder: RoomEventStringBuilder
|
private let eventStringBuilder: RoomEventStringBuilder
|
||||||
private let name: String
|
private let name: String
|
||||||
private let shouldUpdateVisibleRange: Bool
|
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
|
/// 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
|
/// lists that need to update the visible range on Sliding Sync
|
||||||
init(roomListService: RoomListServiceProtocol,
|
init(roomListService: RoomListServiceProtocol,
|
||||||
roomListServiceStatePublisher: CurrentValuePublisher<RoomListServiceState, Never>,
|
|
||||||
eventStringBuilder: RoomEventStringBuilder,
|
eventStringBuilder: RoomEventStringBuilder,
|
||||||
name: String,
|
name: String,
|
||||||
shouldUpdateVisibleRange: Bool = false,
|
shouldUpdateVisibleRange: Bool = false,
|
||||||
notificationSettings: NotificationSettingsProxyProtocol,
|
notificationSettings: NotificationSettingsProxyProtocol,
|
||||||
appSettings: AppSettings) {
|
appSettings: AppSettings) {
|
||||||
self.roomListService = roomListService
|
self.roomListService = roomListService
|
||||||
self.roomListServiceStatePublisher = roomListServiceStatePublisher
|
|
||||||
serialDispatchQueue = DispatchQueue(label: "io.element.elementx.roomsummaryprovider", qos: .default)
|
serialDispatchQueue = DispatchQueue(label: "io.element.elementx.roomsummaryprovider", qos: .default)
|
||||||
self.eventStringBuilder = eventStringBuilder
|
self.eventStringBuilder = eventStringBuilder
|
||||||
self.name = name
|
self.name = name
|
||||||
@ -77,16 +74,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
.sink { [weak self] in self?.updateRoomsWithDiffs($0) }
|
.sink { [weak self] in self?.updateRoomsWithDiffs($0) }
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
roomListServiceStateCancellable = roomListServiceStatePublisher
|
setupVisibleRangeObservers()
|
||||||
.receive(on: DispatchQueue.main)
|
|
||||||
.sink { [weak self] state in
|
|
||||||
guard let self else { return }
|
|
||||||
|
|
||||||
if state == .running {
|
|
||||||
setupVisibleRangeObservers()
|
|
||||||
roomListServiceStateCancellable = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setupNotificationSettingsSubscription()
|
setupNotificationSettingsSubscription()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user