feat(onboarding): unify login into a single OnboardingFlow with linear FlowHost API#778
Merged
bmc08gt merged 8 commits intoMay 28, 2026
Merged
Conversation
…r FlowHost API Replace the fragmented login routing (LoginRouter, standalone screens, and scattered verification logic in MainRoot) with a single OnboardingFlowScreen backed by two FlowHost phases: Account and Permissions. FlowHost API changes: - Add linear flow overload with `steps`, `resumeAt`, and `completedResult` parameters for ordered step-by-step flows - Add `FlowNavigator.proceed()` to advance through the step list, exit with completedResult at the end, or delegate to `onProceed` for custom behavior - Rename the existing overload as the non-linear variant for flows that manage their own navigation via navigateTo/exitWithResult - Extract shared logic into FlowHostImpl; support re-seeding when initialStack changes before user navigation (async flag settling) Onboarding routing: - All AuthState.Registered cases now route to AppRoute.OnboardingFlow with a ResumePoint (Login, AccessKey, AccessKeyThenPurchase, or PostAccessKey) — MainRoot no longer routes directly to Verification - PostAccessKeyRedirect checks UserProfile.verifiedPhoneNumber to skip verification when phone is already linked - Seed restore (LoggedIn) skips verification and goes straight to permissions — existing users encounter phone verification in-app via the send flow - Permissions phase uses the linear FlowHost with resumeAt to skip already-granted permissions Login module restructuring: - Delete LoginRouter, AccessKeyScreen, SeedInputScreen (standalone wrappers) — all step content is now composed inline by OnboardingFlowScreen via the entryProvider - Move ViewModels to internal package, screen content to internal/screens - Add OnboardingStep sealed interface and OnboardingResult for flow step/result modeling Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
a595b08 to
a01d8b8
Compare
…mber Ensures UserProfile (including verifiedPhoneNumber) is available before onboarding routing decisions that depend on phone-linked state. Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
…act routing logic - Add skipContacts flag to OnboardingFlow route, passed from PostAccessKey path - Purchase now exits with ProceedToVerification so IAP paths check phone-linked state and route through verification when needed - Extract resolvePostAccountRoute pure function from composable routing logic - Add OnboardingRoutingTest covering all flow chart paths - Replace prose KDoc with ASCII flow charts documenting each onboarding path Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
…nd loading button states Make ContactCoordinator.sync() and addPickedContacts() suspend returning Result<Unit> so callers can await completion. Add ContactAccessHandle using ContactsPickerSessionContract on API 37+ with phone-only filtering, falling back to full permission on older APIs. Thread isLoading/isSuccess through ContactPermissionBottomBar for visual feedback during sync.
8635a4e to
9186cff
Compare
…ding resumes at access key onAccountPurchased was removing seenAccessKeyKey, and login always set LoggedInWithUser when flags.isRegistered was true, skipping the access key screen on restart. Now onAccountPurchased preserves the flag value, hasSeenAccessKey falls back to selectedAccountIdKey, login gates LoggedInWithUser on seenAccessKey, and RealSessionController respects incomplete onboarding state.
…e for existing users When PhoneNumberSend is enabled, new account creation now launches verification with target=OnboardingFlow(AccessKey) so the user verifies their phone before seeing the access key. Existing users (PostAccessKey) skip verification entirely and go straight to permissions. Verification gating logic moved from composable into LoginViewModel.
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
9186cff to
98f7e7b
Compare
bmc08gt
added a commit
that referenced
this pull request
May 30, 2026
LaunchedEffect(deepLink) in App.kt fired once during cold start, saw currentRouteKey was Loading, and bailed out. MainRoot intentionally defers OpenCashLink/Login actions to App.kt (navigates to plain Scanner without forwarding the entropy). Since deepLink never changed, the effect never re-fired and the link was permanently lost. Add currentRoute as a LaunchedEffect key so the effect re-launches when MainRoot replaces the backstack from Loading to Scanner. The deep link is then dispatched normally (session.openCashLink or viewModel.handleLoginEntropy). The LaunchedEffect(deepLink) single-key pattern was a latent race introduced in 1219d38 (Nav3 migration). It relied on MainRoot transitioning away from Loading before Rinku delivered the deep link (~2-3 frames of async delay). This worked because PassphraseCredentialManager.login() set AuthState.LoggedInWithUser immediately on the fast path — before any network calls — so MainRoot navigated past Loading near-instantly. cfe2964 (#778) changed that fast path from updateUserManager(id, LoggedInWithUser) to just userManager.set(selectedMetadata.id), deferring the auth state transition until after the getUserFlags() network call. This shifted the timing so Rinku now consistently delivers the deep link while still on Loading, the LaunchedEffect bails, and the link is lost. Latent fragility: 1219d38 (fcash/2026.3.4) Surfaced by: cfe2964 (fcash/2026.5.6) Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
bmc08gt
added a commit
that referenced
this pull request
May 30, 2026
) LaunchedEffect(deepLink) in App.kt fired once during cold start, saw currentRouteKey was Loading, and bailed out. MainRoot intentionally defers OpenCashLink/Login actions to App.kt (navigates to plain Scanner without forwarding the entropy). Since deepLink never changed, the effect never re-fired and the link was permanently lost. Add currentRoute as a LaunchedEffect key so the effect re-launches when MainRoot replaces the backstack from Loading to Scanner. The deep link is then dispatched normally (session.openCashLink or viewModel.handleLoginEntropy). The LaunchedEffect(deepLink) single-key pattern was a latent race introduced in 1219d38 (Nav3 migration). It relied on MainRoot transitioning away from Loading before Rinku delivered the deep link (~2-3 frames of async delay). This worked because PassphraseCredentialManager.login() set AuthState.LoggedInWithUser immediately on the fast path — before any network calls — so MainRoot navigated past Loading near-instantly. cfe2964 (#778) changed that fast path from updateUserManager(id, LoggedInWithUser) to just userManager.set(selectedMetadata.id), deferring the auth state transition until after the getUserFlags() network call. This shifted the timing so Rinku now consistently delivers the deep link while still on Loading, the LaunchedEffect bails, and the link is lost. Latent fragility: 1219d38 (fcash/2026.3.4) Surfaced by: cfe2964 (fcash/2026.5.6) Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the fragmented login routing (LoginRouter, standalone screens, and scattered verification logic in MainRoot) with a single OnboardingFlowScreen backed by two FlowHost phases: Account and Permissions.
FlowHost API changes:
steps,resumeAt, andcompletedResultparameters for ordered step-by-step flowsFlowNavigator.proceed()to advance through the step list, exit with completedResult at the end, or delegate toonProceedfor custom behaviorOnboarding routing:
Login module restructuring: