Skip to content

Commit 699c134

Browse files
chore: anonymous account upgrade
1 parent a29ab0a commit 699c134

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Services/AuthService.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,19 @@ public final class AuthService {
169169

170170
public func signIn(credentials credentials: AuthCredential) async throws {
171171
authenticationState = .authenticating
172-
if currentUser?.isAnonymous == true, configuration.shouldAutoUpgradeAnonymousUsers {
173-
try await linkAccounts(credentials: credentials)
174-
} else {
175-
do {
172+
do {
173+
if currentUser?.isAnonymous == true, configuration.shouldAutoUpgradeAnonymousUsers {
174+
try await linkAccounts(credentials: credentials)
175+
} else {
176176
try await auth.signIn(with: credentials)
177177
updateAuthenticationState()
178-
} catch {
179-
authenticationState = .unauthenticated
180-
errorMessage = string.localizedErrorMessage(
181-
for: error
182-
)
183-
throw error
184178
}
179+
} catch {
180+
authenticationState = .unauthenticated
181+
errorMessage = string.localizedErrorMessage(
182+
for: error
183+
)
184+
throw error
185185
}
186186
}
187187

samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample/FirebaseSwiftUIExampleApp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct ContentView: View {
7878
let authService: AuthService
7979

8080
init() {
81-
// Auth.auth().signInAnonymously()
81+
Auth.auth().signInAnonymously()
8282

8383
let actionCodeSettings = ActionCodeSettings()
8484
actionCodeSettings.handleCodeInApp = true

0 commit comments

Comments
 (0)