Skip to content

feat(auth)!: migrate auth navigation to Navigation 3 - #2469

Merged
russellwheatley merged 1 commit into
version-10.0.0-beta05from
feat/auth-navigation-3
Sep 2, 2026
Merged

feat(auth)!: migrate auth navigation to Navigation 3#2469
russellwheatley merged 1 commit into
version-10.0.0-beta05from
feat/auth-navigation-3

Conversation

@demolaf

@demolaf demolaf commented Sep 2, 2026

Copy link
Copy Markdown
Member

The auth module now navigates with Jetpack Navigation 3. Destinations are typed NavKeys in a NavBackStack list rather than string routes in a NavHost, so the address a step carries is a field on the key instead of a URI query argument, and the back stack is a plain list the library can inspect without reflection.

Navigation 2 is removed outright — api(libs.compose.navigation) is gone, replaced by api on navigation3-runtime and navigation3-ui.

  • AuthRoute.kt: extracted from FirebaseAuthScreen, now a @Serializable sealed interface split into Destination (a real NavKey) and FlowEntry (names a flow, resolves to its start step). Also holds resetBackStackTo, pushUnique and popOrNull.
  • AuthUITransitions: three ContentTransform specs receiving Scene<NavKey>, replacing four EnterTransition/ExitTransition lambdas. Scene<NavKey>.authRoute() is public so a consumer can still vary the animation per destination.
  • NavDisplay throws on an empty back stack, so every pop goes through popOrNull.

⚠️ Breaking Changes

  • AuthRoute is a @Serializable sealed interface; route and routePattern are gone. Email steps carry their address, so AuthRoute.Email.SignUp is now AuthRoute.Email.SignUp(). Email/Phone/MfaEnrollment are FlowEntry, not destinations.
  • AuthRoute.Email.Step.withEmail returns a Step, not a String.
  • AuthUITransitions takes transitionSpec/popTransitionSpec/predictivePopTransitionSpec instead of the four Navigation 2 lambdas.
  • Consumers get navigation3-* transitively instead of navigation-compose.

Usage

AuthUITransitions(
    transitionSpec = { fadeIn() togetherWith fadeOut() },
    popTransitionSpec = { fadeIn() togetherWith fadeOut() },
)

Maintainer note: Fixes internal CPRN-403

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the FirebaseUI Android Auth navigation system from Jetpack Navigation Compose to Navigation 3, introducing a serialized AuthRoute hierarchy to persist the back stack across configuration changes and process death. Feedback on the changes highlights a flaw in the phone number masking heuristic that incorrectly handles three-digit country codes, as well as an opportunity to extract the hardcoded transition duration of 700 ms into a reusable constant.

Comment thread auth/src/main/java/com/firebase/ui/auth/mfa/SmsEnrollmentHandler.kt
Comment thread auth/src/main/java/com/firebase/ui/auth/ui/screens/FirebaseAuthScreen.kt Outdated
@demolaf
demolaf force-pushed the feat/auth-navigation-3 branch from 71ea2b2 to dd859f5 Compare September 2, 2026 13:17
@demolaf
demolaf force-pushed the feat/auth-navigation-3 branch from dd859f5 to c43f75b Compare September 2, 2026 13:30
Base automatically changed from feat/mfa-enrollment-per-step-nav to version-10.0.0-beta05 September 2, 2026 14:29

@russellwheatley russellwheatley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - leftover bits can follow up separately

@russellwheatley
russellwheatley merged commit 156d7f5 into version-10.0.0-beta05 Sep 2, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in studio-2394994192-60a69 Sep 2, 2026
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