Commit Graph

10 Commits

Author SHA1 Message Date
Jonas Bark
dc715c9cf2 feat(home): offer local control too, and make the offers act rather than point
Three things a rider asked for, all on the same idea: an offer's button should
do the thing, and nothing should be labelled optional that is plainly working.

- "Enable overlay" now enables the overlay and *then* opens the Overlay
  section. A button that only navigates to another switch is the toast
  problem again, one tap further along. The enable path moved into a shared
  enableTrainerOverlay(), run by both the section's switch and the step, so
  the two cannot drift; it persists the flag only when the platform actually
  put something on screen, so declining Android's draw-over prompt can't
  leave a setting claiming an invisible overlay. A refusal says why, and the
  page opens anyway — that is where the permission tile lives.

- New optional step on the app card: "Add keyboard and mouse actions",
  offered when Local is available on this device but switched off (target is
  This device, per CoreLogic.showLocalControl) and an app is chosen. Local is
  not a way to reach the app, it is a way to do more to it — keystrokes and
  clicks the button editor only offers once it is on — and a rider who never
  turns it on never learns those actions exist. Its button runs the existing
  enableLocalControl(), permission sheet and all.

- The card header drops its OPTIONAL tag once the link is off "off". The
  link stays optional underneath, which is what keeps a trainer nobody owns
  from blocking "Ready to ride", but the word is there to reassure someone
  looking at an empty slot — not to caption connected hardware.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-16 14:52:46 +02:00
Jonas Bark
f0d2d1253b feat(home): make the gear overlay an optional checklist step, not a toast
Riders keep writing in about the wrong gear number in MyWhoosh and others.
The answer has always been the gear overlay, and the one-time toast that said
so was the wrong messenger: it fired once, mid-connect, and scrolled away
before anyone read it.

Move the offer onto the trainer card, where it stays until it is acted on.

- New SetupStepId.trainerGearOverlay, last in the trainer checklist and
  offered only once the bridge is up, the trainer app runs on this device
  (Target.thisDevice), the platform can draw an overlay, and a Virtual
  Shifting session is producing a gear to draw. Ticks off — and leaves the
  card — as soon as the overlay is enabled.
- Its button reads "Enable overlay" and deep-links to the trainer detail
  page's Overlay section, which owns the permission and PiP flows.
- SetupStep gains an `optional` flag so an offer stays an offer: it does not
  colour the card, does not count towards the banner's steps, and never
  stops "Ready to ride". Marked OPTIONAL on its own line, via the tag the
  card header already wore (now a shared OptionalTag).
- Drops OverlayConnectHint, its ProxyDevice listener and the
  overlay_connect_hint_shown flag. The two l10n strings it owned are reused
  as the step's hint and button label in all six locales.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-16 13:03:56 +02:00
Jonas Bark
c66cac4591 feat(home): the Click V2 setup step, status warning glyphs, and an unused trainer's pitch
Three chain-card changes. They arrived as one commit because the first
was still uncommitted when the others landed on top of it.

**A Click V2 waiting for its unlock-mode choice.** Reported edge case: a
brand-new install where the wizard was skipped or finished on another
controller leaves clickV2OnboardingDone false, so a Click V2 switched on
afterwards is discovered, in range, healthy — and deliberately not
connected. The chain had no way to say "we are choosing not to connect
this", fell back to presence, and told the rider their controller had
never been paired and should be brought back into range, about a device
switched on beside them.

That step now REPLACES the checklist rather than joining it. Putting it
first would have left the false steps sitting below it; every other step
is unknowable until the device is allowed to connect. Once the choice is
made the normal checklist returns. The card's action reads "Set up" and
opens the explainer, since the choice is what releases the controller
into the connect queue.

**Warning glyphs beside the status.** A flat battery, a pending firmware
update or a signal about to drop are qualifiers on "Connected" — it
works, but not for much longer, or not well — and the card said nothing.
They show only when something is actually wrong, so a glyph appearing
means something. Thresholds are the device page's own (20%, -70 dBm)
rather than new ones, so the two screens cannot disagree about "low".

**The bridging pitch on an unused trainer.** A trainer that is here but
has never been connected now shows what bridging it would buy instead of
an empty card; that list already existed on the device page, and this is
exactly the rider who has not seen it. Dropped once bridged, where live
numbers are the useful content, and dropped for one that broke
mid-session, where it would read as if nothing were wrong.

Not covered by tests: which badges get chosen, and when the feature list
appears — both are private methods on _HomePageState, which has no
widget test to hang a case on.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 19:41:37 +02:00
Jonas Bark
d985e6d2b5 feat(accessory): name the actions an accessory obeys, and where to assign them
An accessory's settings page had nothing to say about what the device can
actually do: its actions live on a controller's buttons, and the page that
would have shown them (button mapping) is hidden here because a fan has no
buttons of its own.

It now lists them — the six Headwind speed/HR actions, the four incline
ones — straight off the device via a new BaseDevice.assignableActions, and
hands over to the controller that can carry them: the connected one, since
that is the one a rider can test a mapping on right away. With no
controller around it says so rather than offering a dead link.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 16:23:28 +02:00
Jonas Bark
04c97f20dc fix(home): show accessories so a stray Headwind can be ignored
Every Headwind or Climb the scanner finds is connected automatically,
including one that isn't the rider's — a neighbour's fan through a wall.
Getting rid of it means putting it on the ignore list, and the only route
onto that list is "Disconnect & forget" on a device's settings page. But
accessories are excluded from controllerDevices, which is the only device
list the setup chain renders, so such a device appeared nowhere at all and
could not be dismissed.

They now get their own quiet section below the chain: one card per
accessory, no checklist, opening the settings page that already carries
the forget action. That page in turn drops the button-mapping section and
"Reset to defaults" for an accessory — a fan has no buttons, so both were
empty promises — and titles itself "Device Settings" instead of
"Controller Settings". A Headwind also stops presenting itself with the
default gamepad icon.

Auto-connecting to any accessory in range is left as it is: the rider
ignores the neighbour's fan once, and it stays gone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 16:05:25 +02:00
Jonas Bark
1b72284c41 feat(home): show only the steps still to do
A ticked step has said everything it can the moment it ticks. Keeping it
on screen buries the one line that still matters under a list of things
that don't — and a card whose work is finished was spending a whole row on
telling the rider so.

Cards now render their outstanding steps and nothing else, and the
accordion goes with them: no summary row, no "N of M steps done", no
chevron, no tap to unfold a list of completed work. A finished card is
just its header. The banner already carries the count across the whole
chain, so the per-card tally was saying it twice.

startsExpanded gives way to pendingSteps in the model — the card had no
open/closed state left to remember. The first outstanding step is still
the active one and still carries the sole instructions button. The
AnimatedSize stays: when the last step ticks the card folds to its header
as a movement rather than a jump.

chainStepsDone and chainAllStepsDone were the accordion's only copy, so
they come out of all six locales rather than linger as strings nothing
renders.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 15:33:22 +02:00
Jonas Bark
56a8e87f7d i18n(home): translate the setup chain, align its checklist, stop billing
undelivered shifts

Three things.

The chain's 68 strings existed only in English, so five locales fell back
to it on the app's main screen. Now translated, in each file's own register
— informal second person throughout, matching the copy already around
them. Polish needed a `few` plural category for the step and day counters:
it uses a distinct form for 2-4, so `other` would have rendered "Zostały 2
kroków" instead of "kroki". Two keys written speculatively and never wired
up are dropped rather than sent to five translators.

The checklist's summary row sat inside a Button whose own padding inset it
past the steps below, and the leading glyphs differed in both width (15px
icon, 17px tick) and gap, so matching the outer inset alone would not have
lined them up. One _rowInset / _leadingSize / _leadingGap now governs both,
with the glyphs centred in a box of equal width. Two tests pin the tick and
the label columns, because this is exactly what drifts back unnoticed.

Finally, shifting with a trainer connected but no app holding the bridge
was charged to the daily command budget. Those shifts reach nothing. The
existing exemption only covered the case where the 20-minute
virtual-shifting budget was already ticking — that avoids double-billing —
so it grows a second reason: a command that was never delivered anywhere is
not a command the rider spent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 14:39:07 +02:00
Jonas Bark
ca885c79d9 fix(trial): commands are capped during the trial too, and say so
"Unlimited commands until the trial ends" was not true.
RevenueCatService.canExecuteCommand is dailyCommandCount <
getDailyCommandLimit() and returns early only for purchased users — never
for trial users. What actually happens is setDailyCommandLimit(80) while
the trial runs, falling back to 15 once it expires. So the cap is 80/day
during the trial and 15/day after, and the card now shows the command
meter in both states rather than promising something the code does not do.

The same falsehood was in trialPeriodDescription, which is worse: it is
rendered only while the trial is live (iap_status_widget's !isTrialExpired
branch) and handed the *current* limit, so it read "unlimited now, 80 per
day later" — where 80 is precisely the limit that applies now. Corrected
in all six locales rather than leaving five of them asserting it, each
keeping the informal register its neighbouring strings already use.

More Options opens by default — what is in it is short, and collapsing it
on a screen the rider is already scrolling only hides it — and the quit
row now says what it does to the connections as well as to the app.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 14:07:29 +02:00
Jonas Bark
3f83351144 feat(home): connect trainers from the card, animate status changes
Three things the chain got wrong once a real trainer was in the room.

The trainer card offered "Edit" for a trainer that had never been
connected — an offer to edit nothing. It now offers Connect until the
trainer is actually bridged, and that opens the onboarding trainer picker
itself: connectTrainerFromPicker is extracted so onboarding and the home
card share one path, and "connect my trainer" behaves identically wherever
a rider reaches it. Extracting it also removed an empty `if
(device.isSmartTrainer) {}` that the consent removal had left behind.

The checklist is withheld until the rider has committed to bridging. A
trainer merely in range and one deliberately left on "let the app handle
shifting" are the same state underneath — not connected — and in both
cases a column of unticked boxes reads as work outstanding when there is
none. That surfaced a related bug: picking "No connection" sets
autoConnect false, but a trainer that had connected earlier in the session
was still classified as lost, so deliberately disconnecting it turned the
card red. An explicit "no connection" is now a resting state regardless of
what happened earlier.

Status changes animate. The checklist grows and shrinks through
AnimatedSize, so when the last step ticks the card folds to its one-line
summary as a movement the eye can follow rather than a jump; the card
border and the banner — colour, wash, and the badge resizing between its
calm and alarmed sizes — move on the same curve, so the screen resolves as
one gesture instead of several. The test asserts the collapse is genuinely
taller mid-flight than at rest, because "it animates" is otherwise not
something a test can hold onto.

Finally, the trainer-app instructions sheet was a thinner retelling of the
setup steps rather than the steps themselves. The onboarding guide block
is extracted as OnboardingAppGuideCard and both use it, so a rider who
loses the connection gets the same numbered steps, the same screenshots
and the same full-guide link that got them connected in the first place.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 12:27:35 +02:00
Jonas Bark
55e2229a98 feat(home): rebuild the main screen as the setup chain
The old Main tab showed three cards that each exposed whatever the app
happened to know — battery, BETA tags, four live metrics, a media toggle,
a dropdown — and none of them answered the only question a rider has
before a ride: am I ready? When something broke, nothing on screen said
which link failed or what to do about it.

Now every link in the chain gets one card with the same three parts: a
status light in one shared vocabulary, an Edit in the same place on every
card, and a tick-off checklist whose next action carries its own
instructions. Ready cards collapse to one line; unresolved cards open
themselves onto the single active step. Green stays in the dot and ready
status lines stay grey, so colour on this screen always means "look
here". The banner is derived from the cards below it, never asserted
separately, so it cannot contradict them.

Remembered devices close a real gap. A controller that was switched off
or out of range vanished from the app completely — riders could not see
what they owned, could not tell "never set up" from "not here right now",
and could not change a mapping away from the bike. The contour now stays
on screen and stays interactive while disconnected, since mapping a
button is a keymap edit, not a radio operation. Swiping a disconnected
card forgets it, with Undo; a connected one has no dismiss gesture at
all, so the swipe can never drop a working controller.

Desktop follows ui_kits/app-desktop: the chain reads as one centred
column and the activity log is promoted from a tab to a permanent rail,
which is where Help now lives.

The status dot pulses six times rather than forever. This app holds a
wakelock so the home screen can sit lit on a handlebar for an entire
ride, and an animation that never ends also never lets a frame loop go
quiet — which hung every widget test that rendered an attention card.

Nothing is dropped: the scan options, media-key and phone-steering
toggles, ignored-devices list, recording indicator and quit action move
into a collapsed "More options" section below the chain.

Verified against a stashed baseline — the suite's 32 failures (stale
golden screenshots plus one load-dependent flake) are all pre-existing
and unchanged; 93 new tests pass and analyze is clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 10:38:37 +02:00