Skip to content

Commit 2819e30

Browse files
format
1 parent 9c5898f commit 2819e30

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Services/AuthService.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ public final class AuthService {
220220
updateAuthenticationState()
221221
} catch {
222222
authenticationState = .unauthenticated
223-
223+
224224
// Check for reauthentication errors first
225225
try await handleErrorWithReauthCheck(error: error)
226-
226+
227227
// If not a reauth error, check for conflicts
228228
// Possible conflicts from user.link():
229229
// - credentialAlreadyInUse: credential is already linked to another account
@@ -303,7 +303,7 @@ public extension AuthService {
303303
try await user.delete()
304304
} catch {
305305
try await handleErrorWithReauthCheck(error: error)
306-
throw error // If we reach here, it wasn't a reauth error, so rethrow
306+
throw error // If we reach here, it wasn't a reauth error, so rethrow
307307
}
308308
}
309309

@@ -316,7 +316,7 @@ public extension AuthService {
316316
try await user.updatePassword(to: password)
317317
} catch {
318318
try await handleErrorWithReauthCheck(error: error)
319-
throw error // If we reach here, it wasn't a reauth error, so rethrow
319+
throw error // If we reach here, it wasn't a reauth error, so rethrow
320320
}
321321
}
322322
}
@@ -715,7 +715,7 @@ public extension AuthService {
715715
currentUser = auth.currentUser
716716
} catch {
717717
try await handleErrorWithReauthCheck(error: error)
718-
throw error // If we reach here, it wasn't a reauth error, so rethrow
718+
throw error // If we reach here, it wasn't a reauth error, so rethrow
719719
}
720720
}
721721

@@ -769,7 +769,7 @@ public extension AuthService {
769769
/// - Throws: Appropriate `AuthServiceError` based on the provider type
770770
private func requireReauthentication() async throws -> Never {
771771
let providerId = try await getCurrentSignInProvider()
772-
772+
773773
// Try to find display name from registered provider
774774
let providerDisplayName: String
775775
if let registeredProvider = providers.first(where: { $0.id == providerId }) {
@@ -778,7 +778,7 @@ public extension AuthService {
778778
// Fallback for built-in providers (email/password) that don't have AuthProviderUI
779779
providerDisplayName = getProviderDisplayName(providerId)
780780
}
781-
781+
782782
let context = ReauthContext(
783783
providerId: providerId,
784784
providerName: providerDisplayName,
@@ -860,7 +860,7 @@ public extension AuthService {
860860
return freshFactors
861861
} catch {
862862
try await handleErrorWithReauthCheck(error: error)
863-
throw error // If we reach here, it wasn't a reauth error, so rethrow
863+
throw error // If we reach here, it wasn't a reauth error, so rethrow
864864
}
865865
}
866866

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Services/ReauthenticationHelpers.swift

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,35 @@ import FirebaseAuth
2222
/// - operation: The operation to execute
2323
/// - Throws: Rethrows errors from the operation or reauthentication process
2424
@MainActor
25-
public func withReauthenticationIfNeeded(
26-
authService: AuthService,
27-
coordinator: ReauthenticationCoordinator,
28-
operation: @escaping () async throws -> Void
29-
) async throws {
25+
public func withReauthenticationIfNeeded(authService _: AuthService,
26+
coordinator: ReauthenticationCoordinator,
27+
operation: @escaping () async throws
28+
-> Void) async throws {
3029
do {
3130
try await operation()
3231
} catch let error as AuthServiceError {
3332
// Check if this is a reauthentication error
3433
let context: ReauthContext?
35-
34+
3635
switch error {
37-
case .emailReauthenticationRequired(let ctx):
36+
case let .emailReauthenticationRequired(ctx):
3837
context = ctx
39-
case .phoneReauthenticationRequired(let ctx):
38+
case let .phoneReauthenticationRequired(ctx):
4039
context = ctx
41-
case .simpleReauthenticationRequired(let ctx):
40+
case let .simpleReauthenticationRequired(ctx):
4241
context = ctx
4342
default:
4443
// Not a reauth error, rethrow
4544
throw error
4645
}
47-
46+
4847
guard let reauthContext = context else {
4948
throw error
5049
}
51-
50+
5251
// Request reauthentication through coordinator (shows UI)
5352
try await coordinator.requestReauth(context: reauthContext)
54-
53+
5554
// After successful reauth, retry the operation
5655
try await operation()
5756
}

0 commit comments

Comments
 (0)