From ba553f0c1b85ca835d58f8e736c157cf399b6425 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 31 Aug 2023 17:51:16 +0300 Subject: [PATCH] Move the invites summary provider configuration the underlying sliding sync list is availablle sooner now --- .../Sources/Services/Client/ClientProxy.swift | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index fe8c36e144..f890830af3 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -406,13 +406,15 @@ class ClientProxy: ClientProxyProtocol { notificationSettings: notificationSettings, backgroundTaskService: backgroundTaskService) try await roomSummaryProvider?.setRoomList(roomListService.allRooms()) + inviteSummaryProvider = RoomSummaryProvider(roomListService: roomListService, eventStringBuilder: eventStringBuilder, name: "Invites", appSettings: appSettings, notificationSettings: notificationSettings, backgroundTaskService: backgroundTaskService) - + try await inviteSummaryProvider?.setRoomList(roomListService.invites()) + self.syncService = syncService self.roomListService = roomListService @@ -454,22 +456,6 @@ class ClientProxy: ClientProxyProtocol { // Hide the sync spinner as soon as we get any update back callbacks.send(.receivedSyncUpdate) - - // The invites are available only when entering `running` - if state == .running { - Task { - do { - guard let roomListService = self.roomListService else { - MXLog.error("Room list service is not configured") - return - } - // Subscribe to invites later as the underlying SlidingSync list is only added when entering AllRooms - try await self.inviteSummaryProvider?.setRoomList(roomListService.invites()) - } catch { - MXLog.error("Failed configuring invites room list with error: \(error)") - } - } - } }) }