Skip to content

Commit

Permalink
Add loading indicator for gmail sign in (#1259)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharchevskyi authored Dec 29, 2021
1 parent e096689 commit 587bd81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions FlowCrypt/Functionality/Services/GlobalRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ extension GlobalRouter: GlobalRouterType {
do {
switch route {
case .gmailLogin(let viewController):
viewController.showSpinner()

let googleService = GoogleUserService(
currentUserEmail: appContext.dataService.currentUser?.email,
appDelegateGoogleSessionContainer: UIApplication.shared.delegate as? AppDelegate
Expand All @@ -72,12 +74,16 @@ extension GlobalRouter: GlobalRouterType {
scopes: GeneralConstants.Gmail.mailScope
)
try appContext.userAccountService.startSessionFor(session: session)
viewController.hideSpinner()
proceed(with: appContext.withSession(session))
case .other(let session):
try appContext.userAccountService.startSessionFor(session: session)
proceed(with: appContext.withSession(session))
}
} catch {
if case .gmailLogin(let viewController) = route {
viewController.hideSpinner()
}
logger.logError("Failed to sign in due to \(error.localizedDescription)")
handleSignInError(error: error, appContext: appContext)
}
Expand Down

0 comments on commit 587bd81

Please sign in to comment.