Improve when we show and hide the syncing spinner

This commit is contained in:
Stefan Ceriu
2023-08-30 12:56:02 +03:00
committed by Stefan Ceriu
parent a472d443e0
commit e98c87424a
2 changed files with 9 additions and 6 deletions
@@ -1,4 +1,4 @@
// Generated using Sourcery 2.0.3 — https://github.com/krzysztofzablocki/Sourcery // Generated using Sourcery 2.0.2 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT // DO NOT EDIT
// swiftlint:disable all // swiftlint:disable all
@@ -431,7 +431,10 @@ class ClientProxy: ClientProxyProtocol {
MXLog.info("Received sync service update: \(state)") MXLog.info("Received sync service update: \(state)")
switch state { switch state {
case .running, .terminated, .idle: case .running:
// Show the loading spinner when the sync service goes into running
callbacks.send(.startedUpdating)
case .terminated, .idle:
break break
case .error: case .error:
restartSync() restartSync()
@@ -448,7 +451,10 @@ class ClientProxy: ClientProxyProtocol {
// The sync service is responsible of handling error and termination // The sync service is responsible of handling error and termination
return return
} }
// Hide the sync spinner as soon as we get any update back
callbacks.send(.receivedSyncUpdate)
// The invites are available only when entering `running` // The invites are available only when entering `running`
if state == .running { if state == .running {
Task { Task {
@@ -463,9 +469,6 @@ class ClientProxy: ClientProxyProtocol {
MXLog.error("Failed configuring invites room list with error: \(error)") MXLog.error("Failed configuring invites room list with error: \(error)")
} }
} }
callbacks.send(.receivedSyncUpdate)
} else {
callbacks.send(.startedUpdating)
} }
}) })
} }