Skip to content

fix: gate screen deeplinks to debug - #1157

Open
ovitrif wants to merge 15 commits into
masterfrom
fix/1132-gate-screen-deeplinks-to-debug
Open

fix: gate screen deeplinks to debug#1157
ovitrif wants to merge 15 commits into
masterfrom
fix/1132-gate-screen-deeplinks-to-debug

Conversation

@ovitrif

@ovitrif ovitrif commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1132

This PR confines bitkit://screen/... deep links to debug builds, so release and store APKs cannot honor them even when Dev Mode is enabled.

Description

Screen deep-link registration, sheet lookup, and pending-URI replay now live behind debug/release source sets. Debug builds keep the current developer behavior and still require Dev Mode. Release builds attach no screen URIs to the nav graph, never open a sheet from a screen URI, and never queue one for replay. The activity still strips a screen URI from the intent as belt-and-suspenders. Other bitkit: hosts and payment URIs are unchanged.

Preview

N/A

QA Notes

Dev mode is on by default on debug builds (Settings ▸ Advanced ▸ Dev Settings). The app must be past onboarding.

Manual Tests

  • 1. adb shell am start -a android.intent.action.VIEW -d "bitkit://screen/settings" to.bitkit.dev → Settings opens.
  • 2. Deep-linked Settings → Back: returns to the wallet overview, not the launcher.
  • 3a. bitkit://screen/send → Send sheet on the recipient picker.
    • 3b. bitkit://screen/widgets/price-edit → Bitcoin Price editor.
  • 4. bitkit://screen/recovery-mnemonic and bitkit://screen/backup/show-mnemonic → screen unchanged, recovery phrase never shown, logcat carries Unhandled screen deeplink.
  • 5. bitkit://screen/send/fee-rate → screen unchanged, no crash.
  • 6. Settings ▸ Support → tap Version five times to turn Dev Mode off → bitkit://screen/settings on a warm start and a cold start: wallet overview stays, Settings does not open, logcat carries Ignoring screen deeplink, dev mode is off.
  • 7. regression: scan a bitcoin: / lightning: / lnurl URI → still decodes through the scanner path.
  • 8. Release/store build with Dev Mode on → bitkit://screen/settings: ignored, Settings does not open.

Automated Checks

  • Existing unit tests in ScreenDeepLinksTest.kt, SheetDeepLinksTest.kt, and AppViewModelSendFlowTest.kt still cover URI patterns, sheet lookup, and Dev Mode acceptance/rejection.
  • Journeys under journeys/deeplinks/ still apply on debug builds.
  • CI: standard compile, unit test, and detekt checks run by the PR bot.

@ovitrif ovitrif linked an issue Aug 13, 2026 that may be closed by this pull request
5 tasks
ovitrif and others added 9 commits August 13, 2026 20:15
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@ovitrif
ovitrif force-pushed the fix/1132-gate-screen-deeplinks-to-debug branch from 9c3291d to d50ff74 Compare August 13, 2026 18:23
ovitrif and others added 5 commits August 14, 2026 05:22
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@ovitrif
ovitrif marked this pull request as ready for review August 14, 2026 04:14
@ovitrif
ovitrif requested a review from jvsena42 August 14, 2026 04:14
@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown

Greptile Summary

This PR confines bitkit://screen/... deep links to debug builds while preserving the existing Dev Mode check.

  • Moves screen navigation registration and sheet resolution behind debug/release source-set implementations.
  • Disables screen-link registration, sheet lookup, and pending replay in release variants.
  • Retains activity-intent detachment as an additional safeguard.
  • Updates tests to account for build-specific behavior.

Confidence Score: 5/5

The PR appears safe to merge; no actionable correctness or security failures were identified.

Screen URI registration, sheet resolution, and replay are consistently disabled in release builds, while debug behavior remains equivalent to the previous implementation and continues to require Dev Mode.

Important Files Changed

Filename Overview
app/src/debug/java/to/bitkit/ui/utils/ScreenDeepLinkRuntime.kt Provides the debug-only screen-link registration and sheet-resolution behavior previously available from shared utilities.
app/src/release/java/to/bitkit/ui/utils/ScreenDeepLinkRuntime.kt Disables screen-link registration and sheet resolution for all release variants.
app/src/main/java/to/bitkit/ui/utils/ScreenDeepLinks.kt Delegates build-sensitive behavior to the variant runtime and combines runtime availability with the Dev Mode replay gate.
app/src/main/java/to/bitkit/ui/utils/SheetDeepLinks.kt Delegates sheet IDs and URI resolution to the build-specific runtime.
app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt Prevents release builds from queuing screen URIs even when Dev Mode is enabled.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    URI[bitkit://screen URI] --> Activity[MainActivity detaches URI]
    Activity --> Gate{Debug runtime and Dev Mode enabled?}
    Gate -->|No| Ignore[Ignore URI]
    Gate -->|Yes| Queue[Queue pending screen URI]
    Queue --> Resolve{Sheet URI?}
    Resolve -->|Yes| Sheet[Open allowed sheet route]
    Resolve -->|No| Nav[Replay against registered navigation links]
    Release[Release runtime] --> Disabled[No links, no sheets, no queue]
    Disabled --> Ignore
Loading

Reviews (1): Last reviewed commit: "test: drop debug screen deeplink registe..." | Re-trigger Greptile

@ovitrif ovitrif self-assigned this Aug 14, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>

if (ScreenDeepLinks.isScreenDeepLink(uri)) {
if (!settingsStore.data.first().isDevModeEnabled) {
if (!ScreenDeepLinks.shouldQueue(settingsStore.data.first().isDevModeEnabled)) {

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.

should update the journey condition Precondition: onboarded dev wallet, dev mode on, at least one log file present.

if (ScreenDeepLinks.isScreenDeepLink(uri)) {
if (!settingsStore.data.first().isDevModeEnabled) {
if (!ScreenDeepLinks.shouldQueue(settingsStore.data.first().isDevModeEnabled)) {
Logger.warn("Ignoring screen deeplink, dev mode is off", context = TAG)

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.

nit: Could update the log message now that the skip condition was widened

advanceUntilIdle()

assertNotNull(sut.pendingScreenDeepLink.value)
if (ScreenDeepLinks.isEnabled) {

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.

this is always true in unit tests, check if makes sense keep the test

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.

fix: gate screen deeplinks to debug

2 participants