From 948802ee254a5b5cafbccac4401d421f95bb2704 Mon Sep 17 00:00:00 2001 From: Borut Tomazin Date: Fri, 15 Nov 2024 14:49:01 +0100 Subject: [PATCH] Re-indentation. --- Sources/Google/GoogleAuthenticator.swift | 34 ++++++++++++++++++------ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/Sources/Google/GoogleAuthenticator.swift b/Sources/Google/GoogleAuthenticator.swift index 6e7f88d..e03cfd9 100644 --- a/Sources/Google/GoogleAuthenticator.swift +++ b/Sources/Google/GoogleAuthenticator.swift @@ -23,14 +23,20 @@ extension GoogleAuthenticator: Authenticator { /// SignIn user. /// /// Will asynchronously return the `Response` object on success or `Error` on error. - public func signIn(from presentingViewController: UIViewController, - hint: String? = .none, - additionalScopes: [String]? = .none) async throws -> Response { + public func signIn( + from presentingViewController: UIViewController, + hint: String? = .none, + additionalScopes: [String]? = .none + ) async throws -> Response { guard !provider.hasPreviousSignIn() else { return try await restorePreviousSignIn() } - return try await signInUser(from: presentingViewController, hint: hint, additionalScopes: additionalScopes) + return try await signInUser( + from: presentingViewController, + hint: hint, + additionalScopes: additionalScopes + ) } /// Clears the signIn footprint and logs out the user immediatelly. @@ -46,7 +52,11 @@ extension GoogleAuthenticator: Authenticator { /// Boolean if given `url` should be handled. /// /// Call this from UIApplicationDelegate’s `application:openURL:options:` method. - public func canOpenUrl(_ url: URL, application: UIApplication, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool { + public func canOpenUrl( + _ url: URL, + application: UIApplication, + options: [UIApplication.OpenURLOptionsKey : Any] + ) -> Bool { GIDSignIn.sharedInstance.handle(url) } } @@ -66,11 +76,19 @@ private extension GoogleAuthenticator { } } } - - func signInUser(from presentingViewController: UIViewController, hint: String?, additionalScopes: [String]?) async throws -> Response { + + func signInUser( + from presentingViewController: UIViewController, + hint: String?, + additionalScopes: [String]? + ) async throws -> Response { try await withCheckedThrowingContinuation { continuation in provider - .signIn(withPresenting: presentingViewController, hint: hint, additionalScopes: additionalScopes) { result, error in + .signIn( + withPresenting: presentingViewController, + hint: hint, + additionalScopes: additionalScopes + ) { result, error in switch (result, error) { case (let signInResult?, _): continuation.resume(returning: signInResult.user.authResponse)