Cleanup app coordinator loading indicators

This commit is contained in:
Stefan Ceriu
2023-03-02 14:35:23 +02:00
committed by Stefan Ceriu
parent b5055d1680
commit e7a8dc8cc2
@@ -168,24 +168,19 @@ class AppCoordinator: AppCoordinatorProtocol {
self.restoreUserSession() self.restoreUserSession()
case (.restoringSession, .failedRestoringSession, .signedOut): case (.restoringSession, .failedRestoringSession, .signedOut):
self.showLoginErrorToast() self.showLoginErrorToast()
self.presentSplashScreen(isSoftLogout: false) self.presentSplashScreen()
case (.restoringSession, .succeededRestoringSession, .signedIn): case (.restoringSession, .succeededRestoringSession, .signedIn):
self.hideLoadingIndicator()
self.setupUserSession() self.setupUserSession()
case (_, .signOut, .signingOut): case (_, .signOut, .signingOut):
self.showLoadingIndicator()
self.logout(isSoftLogout: false) self.logout(isSoftLogout: false)
case (.signingOut, .completedSigningOut, .signedOut): case (.signingOut, .completedSigningOut, .signedOut):
self.tearDownUserSession() self.tearDownUserSession()
self.presentSplashScreen() self.presentSplashScreen()
self.hideLoadingIndicator() case (_, .remoteSignOut(let isSoftLogout), .remoteSigningOut):
case (_, .remoteSignOut(let isSoft), .remoteSigningOut): self.logout(isSoftLogout: isSoftLogout)
self.showLoadingIndicator() case (.remoteSigningOut(let isSoftLogout), .completedSigningOut, .signedOut):
self.logout(isSoftLogout: isSoft)
case (.remoteSigningOut(let isSoft), .completedSigningOut, .signedOut):
self.tearDownUserSession() self.tearDownUserSession()
self.presentSplashScreen(isSoftLogout: isSoft) self.presentSplashScreen(isSoftLogout: isSoftLogout)
self.hideLoadingIndicator()
default: default:
fatalError("Unknown transition: \(context)") fatalError("Unknown transition: \(context)")
} }
@@ -283,6 +278,12 @@ class AppCoordinator: AppCoordinatorProtocol {
} }
private func logout(isSoftLogout: Bool) { private func logout(isSoftLogout: Bool) {
showLoadingIndicator()
defer {
hideLoadingIndicator()
}
userSession.clientProxy.stopSync() userSession.clientProxy.stopSync()
userSessionFlowCoordinator?.stop() userSessionFlowCoordinator?.stop()