Skip to content

feat(auth)!: make each email sign-in mode a real navigation destination - #2466

Merged
russellwheatley merged 1 commit into
version-10.0.0-beta05from
feat/auth-per-step-nav-destinations
Sep 2, 2026
Merged

russellwheatley merged 1 commit into
version-10.0.0-beta05from
feat/auth-per-step-nav-destinations

Conversation

@demolaf

@demolaf demolaf commented Sep 1, 2026

Copy link
Copy Markdown
Member

The multi-step email flow (sign-in, sign-up, reset password, email-link) kept its "which mode" state in local composable state shared across a single destination, so switching modes wiped whatever the user had typed, had no back-stack entry, and never animated. This converts it to one destination per mode, so the typed address survives every switch, system back walks through modes in order, and switches animate with the configured transitions.

AuthRoute gains nested per-step routes for all three auth flows and a routePattern/route distinction, so MfaEnrollmentScreen and PhoneAuthScreen can adopt the same per-step navigation later with no further public API change (tracked as follow-up PRs). Error-recovery navigation is now owned solely by the host — EmailAuthScreen no longer navigates itself on error, only reports.

  • EmailAuthDestinations.kt: shared NavGraphBuilder extension registering the four email destinations, used by both FirebaseAuthScreen and the reauthentication sheet.
  • EmailAuthScreen: gained mode/onNavigateToMode (paired — passing one without the other throws at composition) and onEmailTyped; onContinueWithProvider removed (the host owns provider hand-off now).
  • ReauthPresentationState: route round-trip switched from an order-dependent when to an explicit route-string-to-id map, since a flow and its start step can now share a route string.

Added EmailAuthRouteNavigationTest, FirebaseAuthScreenEmailRecoveryTest, EmailAuthScreenModeSwitchTest, EmailAuthHostDestinationsTest and ReauthPresentationStateSaverTest covering preservation across switches and Activity recreation, back-stack bounding, error-recovery push/replace, and both hosts registering identical destinations.

⚠️ Breaking Changes

  • AuthRoute gained nested per-step routes (6 subclasses → 16). An else-less exhaustive when (route) no longer compiles.
  • Route string values changed: auth_emailauth_email_signin, auth_phoneauth_phone_number, auth_mfa_enrollmentauth_mfa_enrollment_select_factor.
  • EmailAuthScreen.onContinueWithProvider removed.

Usage

EmailAuthScreen(
    ...,
    mode = currentBackStackEntry.mode,      // driven by your own NavHost
    onNavigateToMode = { mode, email, replace -> navController.navigate(...) },
)

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 refactors the email authentication flow by splitting the single email destination into individual destinations per authentication mode. This preserves the typed email address across mode switches and Activity recreation, and allows proper back-stack navigation. A review comment suggests an improvement in EmailAuthDestinations.kt to perform the redirect navigation atomically in a single transaction rather than calling popBackStack and navigateToEmailStep sequentially.

@demolaf
demolaf force-pushed the feat/auth-per-step-nav-destinations branch from 972d911 to 19e2f70 Compare September 1, 2026 18:23
@demolaf demolaf changed the title feat(auth)!: give each email auth mode its own navigation destination feat(auth)!: make each email sign-in mode a real navigation destination Sep 1, 2026
@demolaf
demolaf force-pushed the feat/auth-per-step-nav-destinations branch from 19e2f70 to eb1ae89 Compare September 2, 2026 00:52
@demolaf
demolaf force-pushed the feat/auth-per-step-nav-destinations branch from eb1ae89 to 2535e5a Compare September 2, 2026 13:21

@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 - I'll follow up the remaining recovery tests separately

@russellwheatley
russellwheatley merged commit 217e039 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
demolaf added a commit that referenced this pull request Sep 7, 2026
* fix(auth)!: remove non-functional MFA recovery codes (#2457)

* refactor(auth): scope phone verification loading state to the composition that owns it (#2454)

* refactor(auth): let the phone screen own its verification loading state

* fix(auth): read auth state per authUI instance when clearing loading on dispose

* fix(e2e): fix flaky Google credential-linking test (#2455)

* fix(auth): complete MFA challenge sign-in navigation and success callback (#2458)

* feat(auth): add stable resource ids for auth input fields (#2449)

* fix(auth): log diagnostic warning when Google sign-in NoCredentialException fallback exhausts

(cherry picked from commit 6fa4f00)
(cherry picked from commit aca99e7)
(cherry picked from commit 8784b13ce29739ed7785aab9ab6fe4faad2a2981)

* fix(e2e): retry and fail loudly when clearing Firebase Auth emulator data

(cherry picked from commit 8eca4fa)
(cherry picked from commit ac61312)
(cherry picked from commit 126ba985660ff272dbfda427b644ad4fb1ca6197)

* fix(e2e): don't swallow InterruptedException in emulator clear retry loop

(cherry picked from commit a87cfe3)
(cherry picked from commit 3f4ae70)
(cherry picked from commit 1f1ada380039ed5e7476dfc2e38a683e6edb4549)

* feat(auth): reshape reauthContent into a ReauthContentState content slot (#2452)

* feat(auth): reshape reauthContent into a ReauthContentState content slot

* fix(auth): address reauth review findings and retain state across recreation

* refactor(auth): make reauthentication a request-scoped state machine

* fix(auth): keep a proved reauthentication alive when its operation signs out

* fix(auth): tear down phone verification when a reauthentication attempt fails

* test(auth): cover sign-out-during-retry and phone reauth failure end to end

* test(auth): drop the flaky phone reauth e2e case

* test(auth): pin onComplete and factor refresh on successful MFA enrollment (#2462)

* test(auth): pin onComplete and factor refresh on successful MFA enrollment

* test(auth): pin the SMS MFA enrollment route through send, verify and resend

* test(auth): pin the missing TOTP secret guard and the resend's clean enroll

* feat(auth)!: make each email sign-in mode a real navigation destination (#2466)

* feat(auth): make each MFA enrollment step a real navigation destination (#2467)

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

* feat(auth): make reauthentication a navigation destination (#2471)

* fix(auth): clear MFA enrollment flow state on every entry (#2473)

* feat(auth): make each phone auth step a real navigation destination (#2472)

* fix(auth): don't strand phone-only users on email verification after reload (#2474)

* test(auth): cover the write-through recoveries and the custom reauth slot's sheet chrome (#2476)

* test(auth): cover the three recoveries that write a value through to the step they move to

* test(auth): assert a custom reauth slot's email and phone steps stay inside the library sheet

---------

Co-authored-by: Ademola Fadumo <[email protected]>
Co-authored-by: demolaf <[email protected]>
@demolaf demolaf mentioned this pull request Sep 7, 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