Skip to content

Commit b533c03

Browse files
refactor: update the way password confirmation is displayed
1 parent 960f702 commit b533c03

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Services/AuthService.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ public final class AuthService {
138138

139139
private var listenerManager: AuthListenerManager?
140140

141-
private(set) var emailProvider: EmailProviderSwift?
141+
private var emailProvider: EmailProviderSwift?
142+
143+
public var passwordPrompt: PasswordPromptCoordinator {
144+
emailProvider?.passwordPrompt ?? PasswordPromptCoordinator()
145+
}
146+
142147
var emailSignInEnabled = false
143148
private var emailSignInCallback: (() -> Void)?
144149

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/AuthPickerView.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ public struct AuthPickerView<Content: View> {
3333
extension AuthPickerView: View {
3434
public var body: some View {
3535
@Bindable var authService = authService
36-
@Bindable var passwordPrompt = authService.emailProvider?
37-
.passwordPrompt ?? PasswordPromptCoordinator()
3836
content()
3937
.sheet(isPresented: $authService.isPresented) {
4038
@Bindable var navigator = authService.navigator
39+
@Bindable var passwordPrompt = authService.passwordPrompt
4140
NavigationStack(path: $navigator.routes) {
4241
authPickerViewInternal
4342
.navigationTitle(authService.authenticationState == .unauthenticated ? authService
@@ -80,10 +79,10 @@ extension AuthPickerView: View {
8079
.accountConflictHandler()
8180
// Apply MFA handling at NavigationStack level
8281
.mfaHandler()
83-
}
84-
// Centralized password prompt sheet to prevent conflicts
85-
.sheet(isPresented: $passwordPrompt.isPromptingPassword) {
86-
PasswordPromptSheet(coordinator: passwordPrompt)
82+
// Centralized password prompt sheet inside auth flow
83+
.sheet(isPresented: $passwordPrompt.isPromptingPassword) {
84+
PasswordPromptSheet(coordinator: passwordPrompt)
85+
}
8786
}
8887
}
8988

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/UpdatePasswordView.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ public struct UpdatePasswordView {
5353

5454
extension UpdatePasswordView: View {
5555
public var body: some View {
56-
@Bindable var passwordPrompt = authService.emailProvider?
57-
.passwordPrompt ?? PasswordPromptCoordinator()
5856
VStack(spacing: 24) {
5957
AuthTextField(
6058
text: $password,
@@ -116,9 +114,6 @@ extension UpdatePasswordView: View {
116114
} message: {
117115
Text("Your password has been successfully updated.")
118116
}
119-
.sheet(isPresented: $passwordPrompt.isPromptingPassword) {
120-
PasswordPromptSheet(coordinator: passwordPrompt)
121-
}
122117
}
123118
}
124119

0 commit comments

Comments
 (0)