@@ -3,6 +3,7 @@ import Firewrap
33import Firebase
44import FirebaseAuth
55import SwiftBoost
6+ import GoogleSignIn
67import UIKit
78
89public class FirewrapAuth {
@@ -35,6 +36,7 @@ public class FirewrapAuth {
3536
3637
3738 public static func application( _ app: UIApplication , open url: URL , options: [ UIApplication . OpenURLOptionsKey : Any ] = [ : ] ) -> Bool {
39+
3840 let handleEmailWay = handleSignInWithEmailURL ( url) { error in
3941 shared. completionSignInViaEmail ? ( error)
4042 }
@@ -43,7 +45,7 @@ public class FirewrapAuth {
4345 return true
4446 } else {
4547 #if os(iOS) || os(macOS)
46- return false // GIDSignIn.sharedInstance.handle(url)
48+ return GIDSignIn . sharedInstance. handle ( url)
4749 #else
4850 return false
4951 #endif
@@ -95,19 +97,24 @@ public class FirewrapAuth {
9597 completion ? ( nil , . failed)
9698 return
9799 }
98- let credential = OAuthProvider . appleCredential (
99- withIDToken: data. identityToken,
100- rawNonce: nil ,
101- fullName: data. name
102- )
103- Auth . auth ( ) . signIn ( with: credential) { ( authResult, firebaseError) in
104- if let firebaseError {
105- printConsole ( " Sign in with Apple complete with Firebase error: \( firebaseError. localizedDescription) " )
106- completion ? ( data, . failed)
107- } else {
108- printConsole ( " Sign in with Apple complete " )
109- completion ? ( data, nil )
110- }
100+
101+ signInWithApple ( with: data, completion: completion)
102+ }
103+ }
104+
105+ static func signInWithApple( with data: SignInWithAppleData , completion: ( ( SignInWithAppleData ? , FirewrapAuthSignInError ? ) -> Void ) ? ) {
106+ let credential = OAuthProvider . appleCredential (
107+ withIDToken: data. identityToken,
108+ rawNonce: nil ,
109+ fullName: data. name
110+ )
111+ Auth . auth ( ) . signIn ( with: credential) { ( authResult, firebaseError) in
112+ if let firebaseError {
113+ printConsole ( " Sign in with Apple complete with Firebase error: \( firebaseError. localizedDescription) " )
114+ completion ? ( data, . failed)
115+ } else {
116+ printConsole ( " Sign in with Apple complete successfully " )
117+ completion ? ( data, nil )
111118 }
112119 }
113120 }
@@ -149,7 +156,7 @@ public class FirewrapAuth {
149156 printConsole ( " Sign in with Email complete with Firebase error: \( emailError. localizedDescription) " )
150157 completion ? ( . failed)
151158 } else {
152- printConsole ( " Sign in with Email complete " )
159+ printConsole ( " Sign in with Email success complete " )
153160 shared. completionSignInViaEmail = completion
154161 completion ? ( . mustConfirmViaEmail)
155162 }
0 commit comments