Skip to content

Commit

Permalink
Move the invites summary provider configuration the underlying slidin…
Browse files Browse the repository at this point in the history
…g sync list is availablle sooner now
  • Loading branch information
stefanceriu committed Aug 31, 2023
1 parent 432975f commit ba553f0
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions ElementX/Sources/Services/Client/ClientProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)")
}
}
}
})
}

Expand Down

0 comments on commit ba553f0

Please sign in to comment.