Stop relying on the NotificationCenter for removing delivered push notifications:

- this will improve the architecture but more importantly will remove some very flakey unit tests
This commit is contained in:
Stefan Ceriu
2024-04-12 17:46:37 +03:00
committed by Stefan Ceriu
parent 891315ef04
commit 4d513f9ed1
15 changed files with 113 additions and 147 deletions
@@ -32,6 +32,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
private let bugReportService: BugReportServiceProtocol
private let appSettings: AppSettings
private let analytics: AnalyticsService
private let notificationManager: NotificationManagerProtocol
private let stateMachine: UserSessionFlowCoordinatorStateMachine
@@ -82,6 +83,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
self.roomTimelineControllerFactory = roomTimelineControllerFactory
self.appSettings = appSettings
self.analytics = analytics
self.notificationManager = notificationManager
navigationSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator())
@@ -467,7 +469,9 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
}
Task {
await userSession.clientProxy.trackRecentlyVisitedRoom(roomID)
let _ = await userSession.clientProxy.trackRecentlyVisitedRoom(roomID)
await notificationManager.removeDeliveredMessageNotifications(for: roomID)
}
}
@@ -527,6 +531,10 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
sidebarNavigationStackCoordinator.push(coordinator, animated: animated) { [weak self] in
self?.stateMachine.processEvent(.dismissedInvitesScreen)
}
Task {
await notificationManager.removeDeliveredInviteNotifications()
}
}
private func dismissInvitesList(animated: Bool) {