Skip to content

Conversation

@demolaf
Copy link

@demolaf demolaf commented Oct 27, 2025

Proof of Concept

  • Allow the user to pass in their app via closure on AuthPickerView:
AuthPickerView {
  usersApp  // Your app's authenticated/unauthenticated content
}
.environment(authService)

var usersApp: some View {
    NavigationStack {
      VStack {
        if authService.authenticationState == .unauthenticated {
          Text("Not Authenticated")
        } else {
          Text("Authenticated - \(authService.currentUser?.email ?? "")")
          Button {
            authService.isPresented = true  // Reopen the sheet so user can manage account
          } label: {
            Text("Manage Account")
          }
          .buttonStyle(.bordered)
          Button {
            Task {
              try? await authService.signOut()
            }
          } label: {
            Text("Sign Out")
          }
          .buttonStyle(.borderedProminent)
        }
      }
      .navigationTitle("Firebase UI Demo")
    }
  • The AuthPickerView is now wrapped in a .sheet(). This means:
    • The authentication picker appears as a modal sheet over your app.
    • It prevents navigation conflicts between the SDK's navigation and your app's navigation.
    • The developer's app content (usersApp) is always visible underneath.
    • Can use NavigationStack internally as the sheet provides its own context outside of user's app.
  • Implemented our own Navigator class to manage different Auth Views internally (i.e. doesn't affect user's app). This allows us to pop to root from any View and clear the stack. For example, when user signs out, we need to clear the stack so they can't swipe back to authenticated View.

Developer Notes

  • NavigationStack for routing
  • Updated UI for EmailAuthView, PasswordRecoveryView, PhoneAuthView (now split between EnterPhoneNumberView and EnterVerificationCodeView), EmailLinkView.
  • Updated styling for buttons
  • Introduced FirebaseAuthUIComponents package which contains resources, UI components and provider styles.
  • shouldHideCancelButton in AuthUIConfiguration shows "x" close button in AuthPickerView toolbar
  • interactiveDismissEnabled for AuthPickerView sheet
  • Removed isLimitedLogin flag from FacebookAuthProviderSwift, App Tracking Transparency (ATT) drives limited login internally
Simulator.Screen.Recording.-.iPhone.17.Pro.Max.-.2025-10-30.at.17.03.42.mov

@demolaf demolaf marked this pull request as draft October 29, 2025 13:58
Copy link
Member

@russellwheatley russellwheatley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good so far! Hopefully the changes I've requested aren't too drastic

@demolaf demolaf changed the title ui changes feat: AuthPickerView sheet and Navigation stack Oct 30, 2025
@demolaf demolaf marked this pull request as ready for review October 30, 2025 15:38
@russellwheatley russellwheatley changed the title feat: AuthPickerView sheet and Navigation stack refactor: AuthPickerView sheet and Navigation stack Oct 30, 2025
if authService.authenticationState == .unauthenticated {
Text("Not Authenticated")
} else {
Text("Authenticated - \(authService.currentUser?.email ?? "")")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Text("Authenticated - \(authService.currentUser?.email ?? "")")
Text("Authenticated - \(authService.currentUser?.email ?? "")")
Button {
authService.isPresented = true // Reopen the sheet
} label: {
Text("Manage Account")
}
.buttonStyle(.bordered)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for purpose of demonstration, let's show how to access the SignedInView so the user can manager their account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants