mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Switch to a custom HomeserverReachability instead of different publishers
This commit is contained in:
@@ -275,7 +275,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
|
||||
let mediaProvider = authenticationService.classicAppAccount.map { account in
|
||||
MediaProvider(mediaLoader: ClassicAppMediaLoader(classicAppAccount: account),
|
||||
imageCache: .onlyInMemory,
|
||||
homeserverReachabilityPublisher: appMediator.networkMonitor.reachabilityPublisher) // Close enough approximation
|
||||
homeserverReachabilityPublisher: appMediator.networkMonitor.reachabilityPublisher.map(HomeserverReachability.init)) // Close enough approximation
|
||||
}
|
||||
|
||||
let parameters = AuthenticationStartScreenParameters(authenticationService: authenticationService,
|
||||
|
||||
@@ -285,7 +285,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
.store(in: &cancellables)
|
||||
|
||||
let reachabilityNotificationID = "io.element.elementx.reachability.notification"
|
||||
userSession.clientProxy.homeserverConnectivityPublisher.removeDuplicates()
|
||||
userSession.clientProxy.homeserverReachabilityPublisher.removeDuplicates()
|
||||
.combineLatest(flowParameters.appMediator.networkMonitor.reachabilityPublisher.removeDuplicates())
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] homeserverReachability, networkReachability in
|
||||
@@ -293,16 +293,17 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
|
||||
guard let self else { return }
|
||||
switch (networkReachability, homeserverReachability) {
|
||||
case (.reachable, .reachable):
|
||||
flowParameters.userIndicatorController.retractIndicatorWithId(reachabilityNotificationID)
|
||||
case (.reachable, .unreachable):
|
||||
flowParameters.userIndicatorController.submitIndicator(.init(id: reachabilityNotificationID,
|
||||
title: L10n.commonServerUnreachable,
|
||||
persistent: true))
|
||||
case (.unreachable, _):
|
||||
flowParameters.userIndicatorController.submitIndicator(.init(id: reachabilityNotificationID,
|
||||
title: L10n.commonOffline,
|
||||
persistent: true))
|
||||
case (.reachable, .unreachable):
|
||||
flowParameters.userIndicatorController.submitIndicator(.init(id: reachabilityNotificationID,
|
||||
title: L10n.commonServerUnreachable,
|
||||
persistent: true))
|
||||
// Don't alarm the user while we've intentionally suspended the client.
|
||||
case (.reachable, .reachable), (.reachable, .suspended):
|
||||
flowParameters.userIndicatorController.retractIndicatorWithId(reachabilityNotificationID)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
Reference in New Issue
Block a user