feat: introduce AppRouter for centralised navigation - #213
Merged
Conversation
Single @observable @mainactor router that owns per-stack navigation paths and the top-level sheet presentation. Replaces ad-hoc per-screen @State flags and bindings with a generic API: push, pop, popToRoot, popLast, pushAny, setPath, present, dismissSheet, navigate. Per-stack paths are NavigationPath (type-erased) so a single stack can carry mixed Hashable types — Destination cases at the top level and sub-flow Hashable cases (e.g. WithdrawNavigationPath) below — without nested NavigationStacks. Cross-stack navigate(to:) presents the destination's owning sheet and replaces the path; CurrencyInfoScreen uses .id(mint) so leaf swaps rebuild with fresh @State, fixing the deeplink-replace bug. Every mutator logs at INFO via flipcash.router. - BalanceScreen, SettingsScreen, ScanScreen drive their stacks/sheets from the router; remove local navigation @State. - DeepLinkController routes currency links through router.navigate; Session.pendingCurrencyInfoMint is gone. - WithdrawScreen drops its inner NavigationStack and registers WithdrawNavigationPath destinations on the parent (Settings) stack; WithdrawViewModel pushes substeps through router callbacks. - CurrencyDiscoveryScreen drops its inner NavigationStack and pushes through the router. CurrencyInfoScreen drops the metadata: init. - Settings children all push: My Account, App Settings, Advanced Features, Beta, Account Selection, Application Logs, Access Key, Deposit, Withdraw — no more sheet/push mix.
- Replace 14+9+3 hand-rolled #expects in owningStack/sheet mapping tests with parameterized @test(arguments:) — each pair now runs as an independent test case in Xcode. - Inline SettingsToggle into SettingsAppSettingsScreen — its single call site doesn't justify a standalone view.
- Add Navigation: AppRouter section under Architecture & Patterns describing the canonical navigation system, NavigationPath storage, no-nested-NavigationStack rule, and local-vs-routed sheets. - Add two pitfalls: nested NavigationStack crashes with comparisonTypeMismatch; same-case leaf swaps need .id(value). - Add navigation key files to Quick Reference. - Update architecture diagram: Session is @observable, not ObservableObject (migrated previously). - Drop Session from the legacy ObservableObject example list. - Fix test naming convention: drop the XCTest-style test prefix since the project uses Swift Testing. - Fix typo (indetify → identify).
raulriera
force-pushed
the
feat/app-router
branch
from
April 28, 2026 14:29
3ad706d to
5b45fbf
Compare
Route the launch-cover dismiss through AppRouter so the whole balance sheet collapses instead of popping the wizard back to the summary. Show the bill after the sheet animation completes so it enters fresh on ScanScreen instead of being revealed underneath the closing sheet.
Dragging a sheet down to dismiss left its NavigationPath populated, so re-presenting the sheet (e.g. tapping Wallet again) restored the stale leaf instead of starting at root. dismissSheet now clears the dismissed stack's path. Sheet swaps still go through present(_:), which preserves both stacks' paths for return trips.
Replaces the last local @State-driven navigations with router pushes so the trace covers every nav action and deeplinks can reach these screens. Adds .currencyInfoForDeposit, .give, and .deposit destinations and surfaces the mint as its own metadata key in router logs. Reworks dismissSheet to mark-and-clear-on-reopen instead of deferring the path clear via Task — no more "push back, then dismiss" animation, no timing dependency, no async tests. Drops the bidirectional sync between giveViewModel.isPresented and router.presentedSheet that desync'd on swipe-down and stalled the next tap of the give button.
Router navigation logs now cover the user-action trail; the per-event Analytics debug line was duplicating that signal.
The local-vs-router rule needed a clearer tiebreaker for new screens, and the dismiss/present clear-on-reopen contract wasn't documented anywhere — easy for future contributors to add manual popToRoot calls around their own dismissals and fight the router.
bmc08gt
added a commit
that referenced
this pull request
Aug 28, 2026
…694) The launch screen is a fullScreenCover over the creation wizard, and its `dismissParentContainer` was wired to `router.dismissSheet()`. The creation flow is pushed onto the Wallet tab's stack, so there is no sheet to pop and that call returns early — both exits from CurrencyLaunchProcessingScreen, the finished handoff and the failure dismissal, did nothing. The screen hides the back button and disables interactive dismiss, so a user whose launch bill was claimed by someone else was left in the wizard with only its back chevron and force-quit the app. Pop the wizard's owning stack to root instead, matching the convert flow. The stack is named rather than resolved through `popToRoot()`'s topmost lookup, since HomeTabView clears `activeTabStack` while the cover is up. The wiring was correct when it landed in #213, where `.balance` was sheet-hosted and dismissing the sheet tore down the whole flow; #619 made `.balance` tab-hosted and this call site was missed.
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.
Summary
Replaces ad-hoc per-screen navigation flags with a single observable router that owns per-stack paths and the top-level sheet presentation. Cross-stack jumps from deeplinks or push notifications now reliably swap sheets and replace paths, fixing the bug where a deeplink to a different token did nothing while the token info screen was already open.
Test plan