fix: gate screen deeplinks to debug - #1157
Conversation
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>
9c3291d to
d50ff74
Compare
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>
Greptile SummaryThis PR confines
Confidence Score: 5/5The 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.
|
| 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
Reviews (1): Last reviewed commit: "test: drop debug screen deeplink registe..." | Re-trigger Greptile
Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
||
| if (ScreenDeepLinks.isScreenDeepLink(uri)) { | ||
| if (!settingsStore.data.first().isDevModeEnabled) { | ||
| if (!ScreenDeepLinks.shouldQueue(settingsStore.data.first().isDevModeEnabled)) { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
nit: Could update the log message now that the skip condition was widened
| advanceUntilIdle() | ||
|
|
||
| assertNotNull(sut.pendingScreenDeepLink.value) | ||
| if (ScreenDeepLinks.isEnabled) { |
There was a problem hiding this comment.
this is always true in unit tests, check if makes sense keep the test
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
screenURI from the intent as belt-and-suspenders. Otherbitkit: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
adb shell am start -a android.intent.action.VIEW -d "bitkit://screen/settings" to.bitkit.dev→ Settings opens.bitkit://screen/send→ Send sheet on the recipient picker.bitkit://screen/widgets/price-edit→ Bitcoin Price editor.bitkit://screen/recovery-mnemonicandbitkit://screen/backup/show-mnemonic→ screen unchanged, recovery phrase never shown, logcat carriesUnhandled screen deeplink.bitkit://screen/send/fee-rate→ screen unchanged, no crash.bitkit://screen/settingson a warm start and a cold start: wallet overview stays, Settings does not open, logcat carriesIgnoring screen deeplink, dev mode is off.regression:scan abitcoin:/lightning:/lnurlURI → still decodes through the scanner path.bitkit://screen/settings: ignored, Settings does not open.Automated Checks
ScreenDeepLinksTest.kt,SheetDeepLinksTest.kt, andAppViewModelSendFlowTest.ktstill cover URI patterns, sheet lookup, and Dev Mode acceptance/rejection.journeys/deeplinks/still apply on debug builds.