From cd7fedda97e81aee021c6d929a62fa022af73ed2 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 25 Aug 2023 09:53:57 +0300 Subject: [PATCH] Fixes #1555, #1562 - Prevent the syncing indicator from showing up every time the app becomes active --- ElementX/Sources/Application/AppCoordinator.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index 2f21517fe..1c7a7e715 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -562,6 +562,10 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate, ServiceLocator.shared.userIndicatorController.submitIndicator(.init(id: identifier, type: .toast(progress: .indeterminate), title: L10n.commonSyncing, persistent: true)) } + guard clientProxyObserver == nil else { + return + } + // Prevent the syncing indicator from showing over the offline one if ServiceLocator.shared.networkMonitor.reachabilityPublisher.value == .reachable { showLoadingIndicator() @@ -610,7 +614,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate, @objc private func applicationWillTerminate() { - userSession?.clientProxy.stopSync() + stopSync() } @objc @@ -624,7 +628,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate, backgroundTask = backgroundTaskService.startBackgroundTask(withName: "SuspendApp: \(UUID().uuidString)") { [weak self] in guard let self else { return } - userSession?.clientProxy.stopSync() + stopSync() backgroundTask?.stop() backgroundTask = nil