mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Await for room sync only for push notification invites (#3307)
This commit is contained in:
parent
5d678abd26
commit
943f33b496
@ -32,7 +32,8 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
private var userSession: UserSessionProtocol? {
|
||||
didSet {
|
||||
userSessionObserver?.cancel()
|
||||
if userSession != nil {
|
||||
if let userSession {
|
||||
userSession.clientProxy.roomsToAwait = storedRoomsToAwait
|
||||
configureElementCallService()
|
||||
configureNotificationManager()
|
||||
observeUserSessionChanges()
|
||||
@ -57,6 +58,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
|
||||
private let appRouteURLParser: AppRouteURLParser
|
||||
@Consumable private var storedAppRoute: AppRoute?
|
||||
private var storedRoomsToAwait: Set<String> = []
|
||||
|
||||
init(appDelegate: AppDelegate) {
|
||||
let appHooks = AppHooks()
|
||||
@ -303,6 +305,14 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
return
|
||||
}
|
||||
|
||||
if content.categoryIdentifier == NotificationConstants.Category.invite {
|
||||
if let userSession {
|
||||
userSession.clientProxy.roomsToAwait.insert(roomID)
|
||||
} else {
|
||||
storedRoomsToAwait.insert(roomID)
|
||||
}
|
||||
}
|
||||
|
||||
handleAppRoute(.room(roomID: roomID, via: []))
|
||||
}
|
||||
|
||||
|
@ -1970,6 +1970,11 @@ class ClientProxyMock: ClientProxyProtocol {
|
||||
var underlyingIgnoredUsersPublisher: CurrentValuePublisher<[String]?, Never>!
|
||||
var pusherNotificationClientIdentifier: String?
|
||||
var roomSummaryProvider: RoomSummaryProviderProtocol?
|
||||
var roomsToAwait: Set<String> {
|
||||
get { return underlyingRoomsToAwait }
|
||||
set(value) { underlyingRoomsToAwait = value }
|
||||
}
|
||||
var underlyingRoomsToAwait: Set<String>!
|
||||
var alternateRoomSummaryProvider: RoomSummaryProviderProtocol?
|
||||
var notificationSettings: NotificationSettingsProxyProtocol {
|
||||
get { return underlyingNotificationSettings }
|
||||
|
@ -112,6 +112,8 @@ class ClientProxy: ClientProxyProtocol {
|
||||
verificationStateSubject.asCurrentValuePublisher()
|
||||
}
|
||||
|
||||
var roomsToAwait: Set<String> = []
|
||||
|
||||
private let sendQueueStatusSubject = CurrentValueSubject<Bool, Never>(false)
|
||||
|
||||
init(client: ClientProtocol,
|
||||
@ -431,6 +433,8 @@ class ClientProxy: ClientProxyProtocol {
|
||||
}
|
||||
|
||||
func roomForIdentifier(_ identifier: String) async -> RoomProxyType? {
|
||||
let shouldAwait = roomsToAwait.remove(identifier) != nil
|
||||
|
||||
// Try fetching the room from the cold cache (if available) first
|
||||
if let room = await buildRoomForIdentifier(identifier) {
|
||||
return room
|
||||
@ -446,6 +450,10 @@ class ClientProxy: ClientProxyProtocol {
|
||||
_ = await roomSummaryProvider.statePublisher.values.first(where: { $0.isLoaded })
|
||||
}
|
||||
|
||||
if shouldAwait {
|
||||
await waitForRoomToSync(roomID: identifier)
|
||||
}
|
||||
|
||||
return await buildRoomForIdentifier(identifier)
|
||||
}
|
||||
|
||||
@ -837,8 +845,6 @@ class ClientProxy: ClientProxyProtocol {
|
||||
return nil
|
||||
}
|
||||
|
||||
await waitForRoomToSync(roomID: roomID)
|
||||
|
||||
do {
|
||||
let roomListItem = try roomListService.room(roomId: roomID)
|
||||
|
||||
|
@ -114,6 +114,8 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
|
||||
|
||||
var roomSummaryProvider: RoomSummaryProviderProtocol? { get }
|
||||
|
||||
var roomsToAwait: Set<String> { get set }
|
||||
|
||||
/// Used for listing rooms that shouldn't be affected by the main `roomSummaryProvider` filtering
|
||||
var alternateRoomSummaryProvider: RoomSummaryProviderProtocol? { get }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user