mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 12:28:29 +00:00
Remove duplicates from the reachability monitor
This commit is contained in:
committed by
Stefan Ceriu
parent
e58642208d
commit
1d6f1185b9
@@ -436,19 +436,22 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
|
|||||||
|
|
||||||
private func observeNetworkState() {
|
private func observeNetworkState() {
|
||||||
let reachabilityNotificationIdentifier = "io.element.elementx.reachability.notification"
|
let reachabilityNotificationIdentifier = "io.element.elementx.reachability.notification"
|
||||||
networkMonitorObserver = ServiceLocator.shared.networkMonitor.reachabilityPublisher.sink { reachable in
|
networkMonitorObserver = ServiceLocator.shared.networkMonitor
|
||||||
MXLog.info("Reachability changed to \(reachable)")
|
.reachabilityPublisher
|
||||||
|
.removeDuplicates()
|
||||||
if reachable {
|
.sink { reachable in
|
||||||
ServiceLocator.shared.userIndicatorController.retractIndicatorWithId(reachabilityNotificationIdentifier)
|
MXLog.info("Reachability changed to \(reachable)")
|
||||||
} else {
|
|
||||||
ServiceLocator.shared.userIndicatorController.submitIndicator(.init(id: reachabilityNotificationIdentifier,
|
if reachable {
|
||||||
title: L10n.commonOffline,
|
ServiceLocator.shared.userIndicatorController.retractIndicatorWithId(reachabilityNotificationIdentifier)
|
||||||
persistent: true))
|
} else {
|
||||||
|
ServiceLocator.shared.userIndicatorController.submitIndicator(.init(id: reachabilityNotificationIdentifier,
|
||||||
|
title: L10n.commonOffline,
|
||||||
|
persistent: true))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleAppRoute(_ appRoute: AppRoute) {
|
private func handleAppRoute(_ appRoute: AppRoute) {
|
||||||
if let userSessionFlowCoordinator {
|
if let userSessionFlowCoordinator {
|
||||||
userSessionFlowCoordinator.handleAppRoute(appRoute, animated: UIApplication.shared.applicationState == .active)
|
userSessionFlowCoordinator.handleAppRoute(appRoute, animated: UIApplication.shared.applicationState == .active)
|
||||||
|
|||||||
Reference in New Issue
Block a user