Skip to content

feat: manage the watch from the phone and start pairing there - #2205

Draft
jvsena42 wants to merge 26 commits into
feat/wear-shared-guardsfrom
feat/wear-watch-management
Draft

jvsena42 wants to merge 26 commits into
feat/wear-shared-guardsfrom
feat/wear-watch-management

Conversation

@jvsena42

Copy link
Copy Markdown
Member

Part of #2105
Source: team, #2105

Warning

Do not publish the Wear app until #2152 ships. The watch runs the same Spark wallet as the phone, and Spark real-time sync is off (realTimeSyncServerUrl = null), so two live instances share no state. Mainnet is also gated off in this build (Env.IS_MAINNET_ENABLED = false), and everything this PR adds to the phone is hidden on mainnet (Env.isWatchLinkEnabled).

Stacked on #2196 (feat/wear-shared-guards). Part 3 of 3 of phone–watch pairing: managing the watch from the phone, and pairing that the phone starts.

Note

A follow-up PR removes two of the features below as requested during review of this stack: the watch's own QuickPay settings (the watch will follow the phone's QuickPay again, keeping #2196's shared daily limit) and "Pay on Watch". They are reviewed and tested here as built.

Description

  • Starts pairing from the phone: when a connected watch has Bitkit and isn't paired, the phone shows a "Pair Your Watch" sheet (Pair / Later). The watch no longer has a pair button: its no-wallet start screen says "Start on phone" (Restore by phrase stays), and its Pair screen opens only when the phone asks. The matching code on both screens and the phone's PIN before a wallet is sent are unchanged.
    • The sheet shows once per watch, at most once per app start, also when a watch connects while Home shows. Later notes the watch; Pair notes it only when the pairing succeeds, so a failed pairing is offered again. A phone wallet wipe offers watches again from the next app start.
  • Adds the watch's own QuickPay settings in the phone's Watch sheet ("QuickPay on Watch": switch, amount, daily limit, and the watch's spend today), carried to the watch over the link and in the phone's settings backup as optional fields (older Android builds and bitkit-ios ignore them; a backup without them restores watch QuickPay off).
    • Watch QuickPay is off until switched on here, and works only while the phone's QuickPay is on. One payment is capped by the lower of the watch's and the phone's amount; the watch's daily limit caps its own spend, and feat: share invoices, quickpay spend and open sends between phone and watch #2196's shared count keeps both within the phone's daily limit. Turning it on or raising a limit asks for authentication by the same rule as the phone's QuickPay settings.
  • Adds "Pay on Watch" on the phone's send review for a Lightning invoice with an amount while the paired watch is reachable: the phone sends the invoice over the authenticated link and the watch opens Review with the hold to pay, never QuickPay. The phone shows one line: sent to watch, watch busy, watch couldn't take it, or not reachable.
  • Adds a one-time install prompt when a connected watch has no Bitkit ("Bitkit on Your Watch", Install / Later), and "Install on Watch" in the Watch sheet; both open the watch's Play listing.
  • Adds docs (docs/wear.md, docs/timed-sheets.md, docs/screens-map.md), journeys and manual tests.

Out of Scope

  • wear/app: the follow-up PR removes the watch's own QuickPay settings and Pay on Watch (see the note above), simplifies the phone's Watch sheet to one Unpair button, and swaps the sheets' phone illustration for a watch icon.
  • wear/app: a watch that never receives the phone's open request can't be paired (it has no button of its own); the pairing times out on the phone.
  • wear/app: Pay on Watch can show "Sent" when the watch never sees the request in time or its later answer doesn't reach the phone; nothing is paid in those cases.
  • wear/app: Pay on Watch covers BOLT11 invoices with an amount only, not LNURL-pay or Lightning addresses.
  • app: the install prompt opens a Play listing with no watch build until feat: run one wallet on two devices #2152.

Design

N/A — no design available. #2105 is a prototype with no Figma; the sheets reuse the existing sheet host, timed-sheet layout, QuickPay sliders and illustrations.

Preview

Phone Bitkit_Phone_API36 (Android 16) and watch Wear_Large_Round_API37 (Wear OS 7), cold-booted, paired over the debug socket, both on the local ./spark stack, app commit 4c679f2b7.

Watch: no wallet Phone: pair prompt Phone: QuickPay on Watch Phone: PIN on turning it on
Bitkit logo, phone icon, Start on phone, Restore Pair Your Watch sheet with Later and Pair QuickPay on Watch with switch, threshold, daily limit and spent today PIN pad on turning QuickPay on Watch on
Phone: Pay on Watch Phone: sent Watch: the handed-off Review
Send review with Pay on Watch Sent to watch line Watch Review with the hold to pay

Recordings:

  • The pair prompt pairs the watch, phone side:
pair-prompt.mp4
  • Pay on Watch, watch side:
pay-request-from-phone.mp4

QA Notes

Setup

  • Both apps built for the local ./spark stack and connected over the debug socket: journeys/wear/README.md › Local ./spark stack, › Phone and watch over the debug socket, › Two apps on one wallet (a throwaway wallet, local stack only). Cold-boot both emulators and check their clocks agree. Phone PIN 1111, biometrics off, "Require PIN for payments" on where a journey says so.
  • The pair prompt shows once per watch: to see it again while unpaired, follow README › Pair prompt (clear watch_link.json on the phone, never while paired).
  • Physical tests: a Wear OS watch paired in the Wear OS app with an Android phone, dev builds on both (journeys/wear/README.md › On a physical watch).

Journeys

  • J1: new pair-prompt-later.xml — Later closes the prompt and it doesn't return
  • J2: new pair-prompt.xml — the prompt pairs the watch from its no-wallet screen; no prompt after unpair and restart
  • J3: new watch-quickpay-pin.xml — turning QuickPay on Watch on asks for the PIN, lowering doesn't, Back returns
  • J4: new quickpay-watch-limit.xml — the watch's own amount and daily limit hold its QuickPay
  • J5: new pay-request-from-phone.xml — Pay on Watch opens Review with the hold on the watch
  • J6: updated quickpay-shared-daily-limit.xml — with watch QuickPay switched on
  • J7: updated quickpay-skips-hold.xml, quickpay-off-holds.xml, quickpay-over-limit-holds.xml, quickpay-on-app-start.xml — watch QuickPay is off until switched on
  • J8: updated pair-*.xml (nine) — pairing starts on the phone; tap Later if the prompt shows

Manual Tests

Details are in journeys/wear/README.md › Manual tests for pairing (tests 11 to 14 there).

  • 1. Pay on Watch over the real Data Layer
  • 2. The install prompt on a watch without Bitkit
  • 3. Watch limits reach a watch that is away
  • 4. The pair prompt over the real Data Layer (4a–4d: no PIN then retry, two watches, connecting while on Home, after a wipe)

Automated Checks

  • added WatchPairTimedSheetTest.kt, WatchInstallTimedSheetTest.kt, WatchInstallViewModelTest.kt, PairLaunchTest.kt — when each prompt shows, once per watch, the Pair screen opening only from the phone
  • added WatchQuickPayViewModelTest.kt — the watch's QuickPay settings and the PIN rule
  • added PayOnWatchInputTest.kt, PayOnWatchViewModelTest.kt, LinkHandoffTest.kt — which reviews offer Pay on Watch, the four result lines, one-shot requests
  • added SocketLinkTransportTest.kt — the debug socket reports a connected watch
  • updated QuickPayRepoTest.kt (both apps), QuickPaySpendStoreTest.kt, SendViewModelTest.kt, LaunchGateTest.kt, LaunchRequestTest.kt — the watch's caps, a handed-off request never under QuickPay, BOLT11 with an amount only
  • updated PhoneBackupContractTest.kt, WatchBackupContractTest.kt, BackupJsonTest.kt, PhoneSettingsParserTest.kt, SettingsStoreTest.kt — the new optional backup fields both ways
  • updated WatchLinkRepoTest.kt, WatchSheetViewModelTest.kt, PhoneLinkRepoTest.kt, AppViewModelSendFlowTest.kt, TimedSheetManagerTest.kt, WipeWalletUseCaseTest.kt — pairing the offered watch once, the connect recheck, a closed sheet starting nothing, the wipe clearing offered watches

Evidence

  • Gate on 4c679f2b7: just compile, just test (with :wear:testDevDebugUnitTest --rerun), just lint all passed.
  • J1–J6 passed on Bitkit_Phone_API36 (Android 16) and Wear_Large_Round_API37 (Wear OS 7) at 4c679f2b7 on the local ./spark stack; J6's phone log showed "daily spend '350' + '300' exceeds cap '500'". pair-retry-after-cancel.xml, pair-unpair-from-watch.xml and pair-same-wallet.xml passed as part of J8. Both devices showed the same balance (35 734 sats) at the end.
  • Three review rounds: payment and security (Fable), and UI, docs and journeys (Opus); the payment review's second round and the UI review's third found only Lows, which are fixed.

Gaps

  • J7 was not run: those journeys need the private settings wallet restored on both devices and the watch importing from hosted staging VSS. The other six pair-*.xml of J8 were not run.
  • Manual tests 1–4 need physical devices; none were available.
  • In one run, a lightning: link opened on the phone right after its PIN unlock was queued for later and showed no send review until the app restarted. Not isolated; the phone's deferred deeplink handling predates this stack.
  • No changelog fragment: everything is hidden on mainnet until feat: run one wallet on two devices #2152.

Models used

  • Planning/scoping: claude-opus-5-5 (reasoning: medium)
  • Implementation: claude-opus-5-5 (reasoning: medium), claude-fable-5-2 (reasoning: medium)
  • Review: claude-fable-5-2 (reasoning: medium), claude-opus-5-5 (reasoning: medium)
  • Review rounds: 3
  • Journey runs: claude-sonnet-5-5 (reasoning: medium)

🤖 Generated with Claude Code

jvsena42 and others added 26 commits November 29, 2026 09:17
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h sheet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Regtest APK

Built from 4c679f2 (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

This branch has not been deployed

No deployments
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