Skip to content

refactor(app): deep links wait under the gate - #131

Open
OffRange wants to merge 11 commits into
v2from
refactor/deeplink-gate
Open

OffRange wants to merge 11 commits into
v2from
refactor/deeplink-gate

Conversation

@OffRange

@OffRange OffRange commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Summary

Reworks how deep links (today: otpauth://totp imports) get into the app.

  • Links wait under the gate. A link's destination goes onto the overlay under the unlock gate (or first run) and is revealed only when the gate goes, never by back. Only the gate is drawn while it is up, so nothing under it peeks out during a back gesture.
  • Links while the app runs. MainActivity is singleTop and handles onNewIntent. A link under a live session opens directly; otherwise it passes the gate. A newer link replaces one already waiting.
  • Unreadable links are rejected up front. A broken link is reported before the gate, so the user is never asked to unlock for nothing. TotpImportRedirect is gone.
  • The gate says what it is holding back. AuthRoute / OnboardingRoute carry a PendingLink kind and word themselves after it.
  • Features contribute their own matchers (following nav3-recipes modular/koin and usecases/matcher). Each feature binds a LinkMatcher in Koin. Its LinkMatch carries the key, the kind and whether the content is readable. The app matches DeepLinkRequest(intent) against List<LinkMatcher> and no longer lists links itself.

Test plan

  • :app:testPlayStoreDebugUnitTest and :feature:totp:testPlayStoreDebugUnitTest pass
  • :feature:auth (8) and :feature:onboarding (1) biometric/migration tests fail locally, identically on the branch without these changes. Check that CI agrees.
  • On a device: open an otpauth://totp/... link cold, with the app running locked, and with it unlocked
  • On a device: open a malformed otpauth:// link and check the error dialog appears without a gate

🤖 Generated with Claude Code

OffRange and others added 11 commits December 1, 2026 13:55
A back gesture on the gate previewed the overlay entry under it, so locking
over the TOTP picker showed the picker during the swipe (verified on device).
The display now receives the gate alone; everything under it stays decorated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A deep link now becomes its destination, placed on the overlay under the
unlock gate or first run. Unlocking or finishing first run pops only the gate
and reveals it; back can never reach it. The gates carry a PendingLink reason
for their wording instead of the link itself.

The pre-gate TotpImportRedirect screen is gone: the TOTP picker parses the
link and reports one it cannot read. openGateFor, replaceOverlay and the uri
threading through finishUnlock/finishFirstRun go with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
onNewIntent used to read only the intent's action, so a link that reached the
running activity was dropped. It now goes through the same matchers and
AppNavigator.openDeepLink, which slides the destination under a gate already
up, or pushes a fresh gate over it: every link has to pass the gate, even
under a live session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With a link waiting under first run, Welcome hands back to the display, so a
back gesture previewed the picker and then popped first run, leaving a user
with no account on a lock screen for an account that does not exist. First
run now counts as covering the overlay: it is displayed alone and back never
pops it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dropping the pre-gate TotpImportRedirect meant a broken QR code asked the user
to unlock first, only to report the error after, and left them in the app
instead of back in the scanner. DeepLinkChecker now reads every matched link
before the gate goes up. An unreadable link started by an external app shows
only the error and finishes the Activity; one arriving while the app runs is
reported over whatever is showing. The `when` over PendingLink is exhaustive,
so a new link kind has to say how it is checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every link pushed a fresh gate, even right after the user unlocked. With
auto-lock set to anything but "immediately" that asked for a second unlock the
setting had just promised to skip. A link now goes straight to its
destination while the session is live, both when it starts the Activity and
when it reaches a running one; without a session it still waits under the
gate. A plain launch keeps opening on the gate as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two links arriving one after another stacked their destinations, so after the
unlock back from the newer one landed on the older. The overlay below the gate
or first run only ever holds a link's flow, so a new link now replaces it,
under a live session as well. The tabs underneath are untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gate and the welcome screen collapsed PendingLink into a TOTP-only flag
(hasPendingTotpImport, pendingTotpImport). They now carry the PendingLink
itself and pick their wording with an exhaustive `when`, so adding a link kind
such as a server invite fails to compile until both screens say something
for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A link or notification sent with FLAG_ACTIVITY_NEW_TASK to a task whose top is
already MainActivity now reaches that instance through onNewIntent instead of
stacking a second one with its own navigation state and gate. A scanner that
opens a link inside its own task still gets a fresh instance there; only
singleTask would change that, and it is not needed for the gate to hold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- DeepLinkChecker answers isReadable instead of wrapping the link back
- AppViewModel checks launch and incoming links through one helper
- AppNavigator reads state.isCovered directly and clears in one call
- MainActivity builds the launch stack once
- AuthScreen reads the pending link from its route
- WelcomeContent maps the pending link once, comments and tests tidied

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Following nav3-recipes (modular/koin, usecases/matcher): each feature
binds a LinkMatcher in Koin and the app asks all of them, so the app no
longer lists links or knows what any of them carries.

- core:ui adds LinkMatcher / LinkMatch (key, kind, isReadable)
- TotpImportDeepLinkMatcher reads the link itself and is a @single
- AppViewModel matches DeepLinkRequest(intent) against List<LinkMatcher>
- DeepLinkChecker and its cast are gone; the matcher test moves to totp

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant