Skip to content

Commit

Permalink
Re-indentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
borut-t committed Nov 15, 2024
1 parent f4e932d commit 948802e
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions Sources/Google/GoogleAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
}
}
Expand All @@ -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)
Expand Down

0 comments on commit 948802e

Please sign in to comment.