Skip to content

fix(wear): open-on-phone button + reactive auth refresh (#44), duplicate-front message (#45) - #46

Merged
SiteRelEnby merged 2 commits into
mainfrom
fix/wear-open-on-phone-and-duplicate-front
Jul 26, 2026
Merged

fix(wear): open-on-phone button + reactive auth refresh (#44), duplicate-front message (#45)#46
SiteRelEnby merged 2 commits into
mainfrom
fix/wear-open-on-phone-and-duplicate-front

Conversation

@SiteRelEnby

@SiteRelEnby SiteRelEnby commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Fixes #44 and #45.

#44 — "Open Sheaf on phone" screen

Button. The watch's "Open Sheaf on your phone to sign in" screen now has an Open on phone chip. It uses RemoteActivityHelper (system-mediated remote start, so it isn't blocked by the phone's background-activity-launch limits) with a sheaf://open deep link the phone app now registers. The phone's MainActivity just comes to the foreground; the URL carries no redeem params, so captureRedemptionDeepLink ignores it. Toasts "Couldn't reach your phone" if the start fails.

Reactive refresh. When the phone pushes a new token, that screen now updates itself instead of needing a leave-and-return. The auth-state flow was a per-WearAuthManager-instance field, and the data-layer service, the activity, tiles and complications each build their own instance over the same encrypted store. So the service applying a phone-pushed credential updated only its flow, and the login screen (the activity's instance) never saw it. Hoisted the flow into a process-wide singleton, so any instance's saveCredentials/clearCredentials updates the exact flow the UI collects. The existing signal-counter listener stays as a belt-and-suspenders for any write that bypasses this class.

#45 — "switch failed" on a duplicate combination

Creating a front whose exact member set already has an open front returns 409 from the server (fronts.py), which the watch surfaced as a bare "Switch failed" / "error 409". Added a SwitchOutcome (SWITCHED / ALREADY_FRONTING / FAILED); switchFront maps 409 to ALREADY_FRONTING (not queued, not an error, since the state the user wanted already holds) and the callers word it: " already fronting" on the quick-switch tile toast, "Already fronting" on the switch screen. Other permanent 4xx still read as a failure.

Notes

  • New dependency: androidx.wear:wear-remote-interactions:1.0.0 (wear module).
  • New phone deep link: sheaf://open (host-only, BROWSABLE) on MainActivity.

Testing

:app:assemblePlayRelease :wear:assembleRelease :wear:testPlayReleaseUnitTest green. Device checklist before merge:

  • Open-on-phone chip launches the phone app from the watch sign-in screen
  • Watch sign-in screen advances to the menu on a phone token push, without leaving and re-entering
  • Switching to a member set that's already fronting shows "already fronting", not "switch failed"

…ate-front message (#45)

#44, two parts:
- Add an "Open on phone" button to the watch's "sign in on your phone" screen.
  It uses RemoteActivityHelper (system-mediated, so it isn't blocked by the
  phone's background-activity-launch limits) to fire a `sheaf://open` deep link
  the phone app now registers; the phone MainActivity just comes to the
  foreground (the URL carries no redeem params, so the redemption capture
  ignores it). Toasts if the phone can't be reached.
- Make that screen refresh reactively when the phone pushes a token. The auth
  state flow was per-WearAuthManager-instance, so the data-layer service applying
  a phone-pushed credential updated only its own copy and the login screen (a
  different instance) never saw it, forcing a leave-and-return. Hoisted the flow
  into a process-wide singleton so any instance's save/clear updates the exact
  flow the UI collects. The signal-counter listener stays as a belt.

#45: creating a front whose exact member set already has an open front returns
409 from the server, which the watch surfaced as a bare "Switch failed". Added a
SwitchOutcome (SWITCHED / ALREADY_FRONTING / FAILED); switchFront maps 409 to
ALREADY_FRONTING and callers word it accordingly ("<name> already fronting" on
the quick-switch tile, "Already fronting" on the switch screen) instead of an
error.
@SiteRelEnby
SiteRelEnby merged commit 3f1deea into main Jul 26, 2026
1 check passed
@SiteRelEnby
SiteRelEnby deleted the fix/wear-open-on-phone-and-duplicate-front branch July 26, 2026 00:39
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.

"open sheaf on phone" screen on wearos should have option to directly open sheaf on phone from that screen

1 participant