@@ -296,45 +296,25 @@ public extension AuthService {
296296
297297public extension AuthService {
298298 func signInWithGoogle( ) async throws {
299- authenticationState = . authenticating
300- do {
301- guard let clientID = auth. app? . options. clientID else {
302- throw AuthServiceError
303- . clientIdNotFound (
304- " OAuth client ID not found. Please make sure Google Sign-In is enabled in the Firebase console. You may have to download a new GoogleService-Info.plist file after enabling Google Sign-In. "
305- )
306- }
307- let credential = try await safeGoogleProvider. signInWithGoogle ( clientID: clientID)
308-
309- try await signIn ( credentials: credential)
310- updateAuthenticationState ( )
311- } catch {
312- authenticationState = . unauthenticated
313- errorMessage = string. localizedErrorMessage (
314- for: error
315- )
316- throw error
299+ guard let clientID = auth. app? . options. clientID else {
300+ throw AuthServiceError
301+ . clientIdNotFound (
302+ " OAuth client ID not found. Please make sure Google Sign-In is enabled in the Firebase console. You may have to download a new GoogleService-Info.plist file after enabling Google Sign-In. "
303+ )
317304 }
305+ let credential = try await safeGoogleProvider. signInWithGoogle ( clientID: clientID)
306+
307+ try await signIn ( credentials: credential)
318308 }
319309}
320310
321311// MARK: - Facebook Sign In
322312
323313public extension AuthService {
324314 func signInWithFacebook( limitedLogin: Bool = true ) async throws {
325- authenticationState = . authenticating
326- do {
327- let credential = try await safeFacebookProvider
328- . signInWithFacebook ( isLimitedLogin: limitedLogin)
329- try await signIn ( credentials: credential)
330- updateAuthenticationState ( )
331- } catch {
332- authenticationState = . unauthenticated
333- errorMessage = string. localizedErrorMessage (
334- for: error
335- )
336- throw error
337- }
315+ let credential = try await safeFacebookProvider
316+ . signInWithFacebook ( isLimitedLogin: limitedLogin)
317+ try await signIn ( credentials: credential)
338318 }
339319}
340320
@@ -353,18 +333,8 @@ public extension AuthService {
353333 }
354334
355335 func signInWithPhoneNumber( verificationID: String , verificationCode: String ) async throws {
356- authenticationState = . authenticating
357- do {
358- let credential = PhoneAuthProvider . provider ( )
359- . credential ( withVerificationID: verificationID, verificationCode: verificationCode)
360- try await signIn ( credentials: credential)
361- updateAuthenticationState ( )
362- } catch {
363- authenticationState = . unauthenticated
364- errorMessage = string. localizedErrorMessage (
365- for: error
366- )
367- throw error
368- }
336+ let credential = PhoneAuthProvider . provider ( )
337+ . credential ( withVerificationID: verificationID, verificationCode: verificationCode)
338+ try await signIn ( credentials: credential)
369339 }
370340}
0 commit comments