fix(wear): open-on-phone button + reactive auth refresh (#44), duplicate-front message (#45) - #46
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 asheaf://opendeep link the phone app now registers. The phone'sMainActivityjust comes to the foreground; the URL carries no redeem params, socaptureRedemptionDeepLinkignores 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'ssaveCredentials/clearCredentialsupdates 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 aSwitchOutcome(SWITCHED/ALREADY_FRONTING/FAILED);switchFrontmaps 409 toALREADY_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
androidx.wear:wear-remote-interactions:1.0.0(wear module).sheaf://open(host-only, BROWSABLE) onMainActivity.Testing
:app:assemblePlayRelease :wear:assembleRelease :wear:testPlayReleaseUnitTestgreen. Device checklist before merge: