Commit Graph

3113 Commits

Author SHA1 Message Date
Jonas Bark
65d8579199 fix(home): Local control is a fallback, not proof the app is connected
The app link read connectedTrainerConnections, which includes Local.
Local reports connected the moment it is switched on — it types into
whatever window happens to be in front — so it says nothing about
whether the trainer app is reachable. With a network method also enabled
(the default for MyWhoosh) that painted the link green while the
connection the rider actually rides on sat unactivated, hiding the one
thing left to do.

The link now reads non-local connections whenever any non-local method
is enabled, and all of them when Local is all there is — because then
Local IS the answer. The summary uses the same list, so the card cannot
caption itself "Local" while the network method is down.

The rule already existed: InactivityDisconnector draws exactly this
distinction, and connectedNonLocalTrainerConnections was already there
for it. The home chain simply was not using it. So the getter lives in
core.logic beside its siblings rather than as a private method on the
page — the next screen that needs it should find it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 19:52:39 +02:00
Jonas Bark
88615800ee Merge branch '6.4' of github.com:OpenBikeControl/bikecontrol into 6.4 2026-08-11 19:42:25 +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
fe1849a912 Merge branch '6.4' of github.com:OpenBikeControl/bikecontrol into 6.4 2026-08-11 19:37:12 +02:00
Jonas Bark
e9adcd836f feat(onboarding): open on the welcome screen on desktop too
Desktop was routed straight into step 1's rail, which asks a rider to pick
a trainer app before anything has said what BikeControl does or how long
setup takes. The one screen that answers "what am I about to agree to" was
the one desktop never saw.

The screen was built for a phone column — Spacers, full-width buttons,
24px padding — so simply unlocking it would have stretched a column of
short lines across a 1400px window. It is capped to
kOnboardingBodyMaxWidth, the same measure the wizard's own body uses on
desktop, so stepping from the welcome into the rail keeps the text at one
width instead of snapping narrower.

step_app's update banner already keyed off _showedWelcome, so the offer
moves to the welcome screen on desktop by itself and never appears twice;
only its comment claimed desktop had no welcome screen.

The existing test asserted the behaviour being removed, so it is rewritten
around the new one, plus a case pinning the readable measure on a wide
window — that cap is the whole reason this doesn't look wrong on desktop.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 19:36:28 +02:00
Jonas Bark
e34953cd32 get rid of vs onboarding 2026-08-11 19:25:41 +02:00
Jonas Bark
37d01c734a fix(home): SRAM's setup outranks mapping — it is what makes the buttons
The guided setup sat after "assign an action to a button", so a fresh
derailleur told the rider to map buttons it does not yet send. Setting
up is what produces them.

The test that was meant to cover this passed for the wrong reason: the
controller() helper defaults to hasMappedButtons: true, so the mapping
step was already ticked and never competed for the active slot. The
moment buttons are not mapped — every real fresh SRAM — mapping won. The
new case pins hasMappedButtons: false and fails on the old order with
exactly the reported symptom.

Also corrects the comment on that block, which described where the step
sat rather than why.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 19:07:02 +02:00
Jonas Bark
2254d016cb feat(home): SRAM's guided setup is a step, not an empty card
A SRAM derailleur whose own shifting is still enabled is connected and
sends nothing at all. The chain said so with a blank grey panel and no
step — the one thing standing between the rider and a working shifter
was the one thing the card did not mention.

It is a step now, carrying the same wording the device card's own button
uses ("Set up SRAM control"), and "Show me how" opens the same guided
sheet the device card and the onboarding wizard run. It sits BEFORE the
unlock step: a derailleur that sends nothing cannot be helped by
anything about what it sends.

The id and the input field are named for SRAM rather than generically.
A generic controllerGuidedSetup would carry SRAM's wording, and the next
device with its own guided setup would silently inherit a label that
does not describe it — better that it gets its own id.

Checked whether anything else needs one: onboardingDeviceNeedsSetup is
the complete list of guided setups in the app, and it has exactly two
branches. The Click V2's is already on the chain via the explainer and
today's unlock step. SRAM was the only gap.

The empty panel is gone too. A device with no contour and no buttons
discovered yet rendered as a bare grey box that looked like a failed
render; nothing to draw is not the same as an empty box to draw it in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 18:41:51 +02:00
Jonas Bark
cf32a02400 fix the unlocking method 2026-08-11 18:38:30 +02:00
Jonas Bark
b2e210e09d feat(onboarding): every step reveals in reading order, not all at once
The welcome screen already arrived a piece at a time while every other
step faded in as one block. What made the welcome screen feel considered
was never the fade — the other steps had one too — it was the stagger:
content arriving in the order it is meant to be read, so the eye is led
down the page instead of being handed everything and left to find the
starting point.

_Reveal was a private near-duplicate of OnboardingFadeUp (520ms/14px
against 300ms/12px). Rather than copy a third variant around the step
files, both are replaced by one OnboardingReveal, and the page-level
blanket fade gives way to a KeyedSubtree — it would only have competed
with the per-child reveals, while the re-key still re-mounts each screen
so it reveals again on every step change.

Eleven bodies across the six steps, including the controller step's four
phases and the trainer step's three states.

Two judgement calls: Gaps pass through unwrapped, because animating empty
space buys nothing and leaving it in place from the first frame means the
column's layout is settled before anything fades in — nothing shifts under
the rider's eye, and the cadence stays even. And the delay stops growing
after eight items: the controller step's list grows with every device in
the room, and uncapped the last entry on a busy screen would arrive a
second and a half after the first, which a rider reaching for it would
watch move.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 18:25:12 +02:00
Jonas Bark
0626328413 fix(home): a connected Click V2 shows its unlock deadline, not "Connected"
An unlock expires. "Connected" is true but says nothing about the fact
that is about to stop being true, so an unlocked Click V2's card now
reads "Unlocked until Friday, 14:30" — or "Likely unlocked until", where
BikeControl cannot confirm the unlock took. Same two strings the
checklist step uses.

A Click that is currently locked keeps saying "Connected": the step
already carries "unlock it with Zwift", and a stale deadline beside it
would contradict it.

This also fixes a lie the status line could tell. It was derived purely
from LinkStatus, and attention maps to "Out of range" — but attention is
equally what an unfinished checklist produces for a controller sitting
right there connected, which the new unlock step made easy to hit. A
device that is actually here is never described by a presence status
now; that covers the older case of a connected controller with no
buttons mapped too.

Not covered by a test: _controllerStatusLabel is private to
_HomePageState and there is no HomePage widget test to hang a case on —
chain_card_test passes statusLabel in as a plain string, so it never
reaches this. Its inputs are covered through the chain builder tests;
the label selection itself is verified by reading.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 18:18:45 +02:00
Jonas Bark
6dc4136567 fix(click-v2): enabling the new unlock method lands on the right puck
Reported from a device: switching "use new unlock method" on from the
detail page connected only the LEFT puck — the one that needs unlocking
— which is the setup the switch exists to move the rider off.

Two causes, both needed fixing.

Nothing put the rider into a mode. The toggle only flipped the
representation, so with unlock-with-Zwift off and right-side-only off,
the left puck's gate let it connect while the right puck's gate — which
needs one of those two settings — kept it out. Enabling now routes
through chooseRightSideOnly(), so the toggle and the explainer leave
identical state. A rider who deliberately chose unlock-with-Zwift keeps
both sides; this only redirects the default.

And even with the mode set, the right puck could never appear. In the
legacy representation its advert IS scanned and cached, but
fromScanResult returns null for it — the advert is remembered while
resolving to no device, and the scanner then dedupes against that cache
forever. So the switch also restarts the scan, the same thing
restoreLeftSides already needed.

That meant widening what counts as a left puck. In the legacy
representation the unified ZwiftClickV2 IS the left puck, built from its
advert (the right one builds nothing), so ignoring only
ZwiftClickV2LeftSide missed the very case this bug is about.
_ignoreLeftSides now matches ZwiftClickV2 — which covers both classes
and cannot catch the right side, since that extends ZwiftRide — and
restoreLeftSides recognises both label constants, or a puck ignored as
the unified controller could never be restored.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 18:02:03 +02:00
Jonas Bark
bb3bec2d30 fix unlock logic 2026-08-11 17:58:12 +02:00
Jonas Bark
c69c0819ab fix(home): show the unlock deadline, and fix "Unlock again" on the details page
Two things.

The unlock step now says when the unlock runs out rather than just
ticking. That makes it the one done step in the chain carrying detail,
deliberately: an unlock expires, so a bare tick would hide that this
comes back tomorrow.

It also has to distinguish two states the device page already drew
apart. BikeControl cannot read a Click V2's lock state back — after an
unlock it knows when the 24 hours ought to run out, but not whether the
unlock took — so SetupStep.uncertain carries that, and the step reads
"Likely unlocked until Friday, 14:30" instead of claiming more than is
known. The date is preformatted at the page: the chain model stays free
of locales and date formats, which is what keeps it testable without a
loaded locale.

ZwiftClickV2 grows an `unlockedUntil` getter rather than the page
reaching into propPrefs. The +24h arithmetic already existed twice in
that file, and widening its `prop` import is its own hazard — that
package exports a `Set` which shadows dart:core's.

Separately, "Unlock again" on the controller details page threw "No
DrawerOverlay found in the widget tree" and did nothing. The page wraps
itself in a DrawerOverlay, but _buildDeviceCard and _buildActions are
methods on the State, so the context they close over is State.context —
which sits ABOVE the overlay its own build creates. Two callers were
hitting it, "Unlock again" and the device-script drawer. Both now build
from the context under the overlay, the pattern onboarding_page already
documents for the same trap.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 17:46:15 +02:00
Jonas Bark
f6ab5152ec feat(home): show unlocking as an actual step on the chain
A Zwift Click V2 on the legacy unlock method gave the rider nothing to
go on. Zwift locks it to their own app, so it stops sending button
presses about a minute after the last one — which from the chain looked
exactly like a flat battery or a controller out of range, because the
card said nothing at all.

It is a step now, so it ticks like the rest of the checklist and the
card sits amber rather than green while it is outstanding. Last in the
list, since unlocking needs the controller present.

`ControllerInput.unlocked` is nullable rather than a bool: null means
unlocking is not a concept for this controller and the card omits the
line entirely, the same way requiresBluetooth already omits a Bluetooth
step that would never mean anything. That distinction is the whole
design of the field — the step must appear for the legacy unified
controller and for the left puck on unlock-with-Zwift, but not for the
left puck on the restart workaround (it reboots itself; "open Zwift"
would be wrong advice) and not for the right puck, which Zwift never
locked.

The instructions button routes on the active step: a locked Click opens
the unlock flow for that exact device rather than the generic "can't
find your controller" help, which is the answer to a different question.

The hint says why, not just what — riders who do not know Zwift locks
the hardware read "unlock" as a paywall.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 17:22:39 +02:00
Jonas Bark
65f4f22527 fix(home): restore the Click after switching off the split representation
Reported from a device: pick right-side-only, then turn "use new unlock
method" off, and you are left with no Click at all and a chain showing
its empty "Controller" placeholder.

One cause, not two. Right-side-only puts the left puck on the ignored
list — but in the legacy representation the LEFT puck is what becomes
the unified ZwiftClickV2, and the right puck builds nothing at all (see
BluetoothDevice.fromScanResult). Ignored left plus null right leaves
nothing to build, and the "Controller" entry was never an orphan: it is
chainControllerTitle, the placeholder the chain correctly falls back to
when no controller exists.

So the toggle now clears the mode and un-ignores the left side before
switching. That path was private to the onboarding policy on the
assumption that right-side-only was the only way out of it; it is not,
so it becomes restoreLeftSides().

Three UI fixes alongside it.

The error banner over the chain is gone, with the state that only fed it
— both animation controllers, the shake, the latest-error entry. The
activity log and its tab dot are untouched; the chain says what is wrong
now, and a card repeating it above was the older answer to the same
question.

Button-action errors no longer toast while the onboarding wizard is
open. The wizard asks the rider to press a button precisely while the
trainer app or the keymap is not set up yet, so those presses fail by
design, and "X could not be performed" over the step that asked for the
press reads as the wizard being broken. Still logged to the activity
list.

And the checklist's step rows sat 4px from the card edge, so the active
step's highlight read as a panel the card had failed to contain. At 10
it sits inside the card, with StepRow's own inset still letting the
highlight bleed slightly wider than the text.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 17:00:05 +02:00
Jonas Bark
21fd24446d Merge branch '6.4' into 6.4-accessories 2026-08-11 16:28:34 +02:00
Jonas Bark
77596ffbe0 fix(click-v2): ignore the left puck in right-side-only, and name both pucks
Three things the first cut of right-side-only got wrong on a real phone.

The left puck was held back by a setting rather than ignored, so it kept
its entry in the device list and the active scan handed it straight back
— an orphan stuck on "connecting" that never could. Filtering it out of
controllerDevices fixed the onboarding list and missed the home chain,
which also draws from offlineControllers. That is the argument against
inventing a second mechanism: ignoring is the one the scan filter, the
remembered-device loader and the device list all already honour, so
using it takes the puck out of every list at once. The dedicated gate
and the isExcludedBySetup filter are gone with it.

Ignoring has to cover the remembered stand-in too, not just a live
device — the chain lists both side by side, and the card in the report
was a stand-in.

It also has to be undoable, or picking "unlock with Zwift" after
right-side-only silently still yields one controller. Removing the
ignored entry is not enough on its own: the scanner dedupes against its
cached advert, and performScanning() returns immediately while a scan is
already running, so the puck only came back on the next launch. It now
restarts the scan.

Both lists showed "Zwift Click" for both pucks: `name` is the raw BLE
advertised name, identical for the two. They use displayName, which
carries the translated left/right suffix.

Finally, the chain sat 24px in from each screen edge on mobile —
Overview's scroll view pads it by 12 and HomePage added 12 of its own,
before each card's padding on top. Desktop keeps its inset; there the
chain sits in a centred max-width box with no padding of its own.

Known sharp edge, left deliberately: un-ignoring the left puck by hand
while still in right-side-only mode brings both up live, and the right
side's handshake cancels the left's restart timer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 16:23:38 +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
aa0720b984 fix(click-v2): the no-unlock option is the right puck, not the left
The first-run explainer offered "use the left side only" as the way to
avoid Zwift. That is the one puck Zwift actually locks. Picking it left
the rider on the 59-second restart loop, and — because
ZwiftClickV2RightSide.shouldAutoConnect required unlock-with-Zwift — it
also withheld the puck that needs nothing at all. Worse, with Zwift's
built-in keymap binding the right paddle to shiftUp and the left paddle
to shiftDown, the left side alone could only ever shift down. The
genuinely clean setup was reachable only by first choosing the mode it
was meant to replace, then tapping "Use the right side only" on the
right card.

So the option becomes right-side-only: no unlock ever, no restarts, and
the +/B remap the right card already applied so one puck covers both
shift directions. The cons now name the real price — no D-pad, so no
steering and no action bar.

Click V2 state is three modes now, not a boolean, and both connect gates
say so out loud. ClickLogic drives the left side's restart loop from a
single static timer that the right side's handshake cancels, so those
two can never be live together; that invariant used to be implied by one
gate and is now stated in both. Left-restart mode survives as the left
card's existing Select for riders who want the D-pad, just not as a
first-run choice.

The right card's shortcut delegates to the same policy rather than
keeping its own path, so both leave identical state: the left side held
back by the setting instead of pushed onto the ignored-devices list,
which is what lets "Set up again" undo it. Its confirmation copy moves
accordingly, and it stops offering itself once the left side is merely
listed rather than connected.

The remap sits in its own recordError guard. It needs a trainer app to
have been picked, and a mode the rider explicitly chose must not be left
half-written because an optional convenience could not run.

This also turns emulation_zwift_profiles_test's right-side case green:
it had been red since the gate landed, because e74c5920 fixed only the
isPending half of what was holding that side back.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 15:40:00 +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
70f0532da1 feat(home): show the trainer's live values whenever it is connected
Watts and cadence come off the trainer, not off the bridge, so they are
just as real — and just as worth showing — before BikeControl starts
bridging it. Two gates were hiding them: the readout itself required
isBridged, and the builder only passed metrics through on a fully ready
link, so relaxing either alone would have changed nothing.

The readout moves onto ProxyDevice as liveReadout rather than being
reimplemented on the home page, because the home page's version only read
fitnessBike — in proxy mode the numbers live on ProxyBikeDefinition, so it
would have shown an empty line exactly where a proxied trainer's values
belong. It now mirrors showMetaInformation: proxy definition first, then
the fitness bike, plus the gear or ERG target when BikeControl computes
one.

Showing the numbers exposed a contradiction in the status line: "Not
connected · 250 W · 90 rpm" asks the rider to resolve something the app
should have resolved for them. A trainer whose Bluetooth link is up but
which isn't bridged now reads "Connected", which is true, and the Connect
action carries the rest. "Not connected" is left to mean a trainer that
genuinely isn't there. The bridged states keep onboarding's wording.

The metrics ticker was gated on isBridged too, so the numbers would have
been frozen in precisely the state this change exists to show.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 13:50:26 +02:00
Jonas Bark
16ad75336d fix(home): pair-as-trainer instructions, and finish the onboarding audit
"Waiting for MyWhoosh to pick it up" opened the trainer picker, whose
bridged branch renders "Trainer connected" — an answer to a question the
rider wasn't asking. The trainer IS connected; the app hasn't picked the
bridge up. The connection step's pairing block is extracted as
OnboardingPairAsTrainerCard — bridge entry, the power/controllable/cadence
slot rows, the warning about pairing the bare trainer — and both the
wizard and the sheet render it. Routing is on the card's active step, so
the three trainer problems get three answers: not bridged opens the
picker, bridged-but-unclaimed opens the pairing instructions, ready opens
troubleshooting.

Auditing the rest against onboarding turned up two more.

isBridged now lives on ProxyDevice as a single getter that onboarding and
the home screen both call, so the definition cannot drift again. Three
places here were still keyed on the Bluetooth link rather than the bridge:
choosing which trainer the card shows, gating the metrics ticker, and
deciding whether the trial's virtual-shifting meter applies. Each was
measuring or picking the wrong thing.

The worse one: a remembered trainer mapped to amber, and on an optional
card amber blocks "Ready to ride" — so a trainer that was not in the room
would have held the banner hostage. Because the card inferred "bridged"
back out of its own status instead of asking the device, it would also
have claimed to be bridged and offered Edit. An uncommitted trainer now
rests at off, and bridged comes from the device.

Verified equivalent while in there: connectedTrainerConnections.isNotEmpty
is exactly onboarding's .any((c) => c.isConnected.value), since the list is
already filtered, and appHoldsBridge is the same isConnectedListenable the
onboarding summary uses to choose between "Bridged" and "Waiting for {app}".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 13:26:14 +02:00
Jonas Bark
5f4ce5bee9 fix(home): trainer card follows onboarding's definition of connected
The trainer card read ProxyDevice.isConnected — the Bluetooth link to the
trainer — and called that "connected". Onboarding doesn't: a trainer is
bridged when isStartedListenable || isConnectedListenable, and the app
holds it when isConnectedListenable. So a trainer that was genuinely
connected, with a bridge the app hadn't picked up, fell through to the
catch-all label and reported "Not connected" about the one thing that was
working. Onboarding is the source of truth and the card now mirrors it:
Bridged / Waiting for {app}… / not connected, in onboarding's own words.

"Gears set up" is gone. Gear ratios are a preference with a working
default (ShiftingConfig.defaults), so no rider is ever blocked waiting to
set them up, and presenting them as an unticked box invented work that did
not exist. The two steps are now onboarding's two facts — the bridge is
running, and the trainer app picked it up — and the second names the exact
entry to look for ("KICKR CORE - BikeControl"), which is what riders miss.

Whether the bridge is running and whether the app holds it are
ValueNotifiers on ProxyDevice rather than events on the connection stream,
and nothing here listened to them: the card would have held a stale status
until something else forced a rebuild. HomePage now subscribes per proxy
and re-subscribes as trainers appear.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 12:57:56 +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
24f5da596d fix(home): device-testing fixes, and drop the VS takeover dialog
Four things found riding the real app.

The offline note claimed "your changes apply the next time it connects",
which is simply untrue — button mappings live in the keymap, not on the
device, so nothing is queued up waiting for a reconnect. It now says what
is actually true: you can still change what its buttons do.

A smart trainer that had only just been discovered announced itself as
"Wahoo KICKR lost connection". That was mine, and the cause is worth
recording: _handleConnectionQueue calls _connect() on every queued device,
but ProxyDevice.connect() deliberately no-ops unless the rider has asked
for that trainer. Recording "connected this session" right after connect()
returned therefore marked a trainer that never connected as having
connected — and the chain then read the disconnected state as a break.
Recording now hangs off the actual connection signal, and a new
DevicePresence.discovered ("in range, never connected") maps to a grey
"Not connected" that, being optional, doesn't stop the rider being ready.
A trainer that genuinely drops is still red.

"More options" had picked up two things that don't belong in a settings
drawer: a scanner running a permanent searching animation, implying work
the app wasn't doing on anyone's behalf, and a Close row on desktop, where
SystemNavigator.pop() does nothing useful and the window's own close
button is the way out. Pairing lives in the controller card's setup sheet,
which is where the scanner already was.

The virtual-shifting takeover dialog is gone entirely — the widget, the
shouldAutoConnect gate, the settings accessors and the onboarding call
site. Tapping Connect once is the whole consent story. Two tests asserted
the old gate; one is rewritten around intent alone being sufficient, and
the widget test for the dialog's presence is dropped rather than inverted,
because showSmartTrainerConsentDialog no longer exists and bringing the
gate back could not compile.

Also removes twelve imports in overview.dart left orphaned by the chain
refactor. Verified against the untouched 6.4 baseline: analyze reports no
errors, and the suite's failures are unchanged pre-existing golden drift.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 12:02:24 +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
Jonas Bark
0c91cc7465 feat(home): setup-chain model and remembered devices
The home screen is being rebuilt as the setup chain: one card per link,
each carrying the same status light and the same tick-off checklist. This
lands the parts that decide *what* the screen says, ahead of the widgets
that draw it.

chain_state.dart is pure data with no Flutter, no BLE and no `core`, and
steps carry ids rather than sentences, so "which step is done or pending"
is unit-testable without a locale or a radio. chain_builder.dart turns a
plain ChainInputs snapshot into cards; deriveBanner reads the cards back,
so the banner can never contradict what is under it.

Remembered devices fix a real gap: a controller that is switched off or
out of range disappeared from the app entirely, so riders could not see
what they owned or edit a mapping away from the bike. We now store the
advertisement a device connected with — exactly the fields
BluetoothDevice.fromScanResult reads — and rebuild it into a real device
object of the right subclass, kept out of the connect queue. Trainers are
remembered as data only, since their card needs a name, not a contour.

Tracking which ids connected this session is what separates a red "lost
connection" from an amber "out of range"; a fresh launch with the
controller in a drawer must not paint the screen red.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 10:38:19 +02:00
Jonas Bark
44f8be9ad5 feat(paywall,l10n): shrink Base card, translate onboarding into de/es/fr/it/pl
The Base-version row on the mobile paywall dominated the plan cards it sits
under; tighten its padding, radius and type scale and give the radio a small
16px variant so it reads as the secondary option it is.

Translate the 182 onboarding/paywall keys added on this branch into all five
non-English locales, and refresh the four strings whose English wording
changed (billing lines, SRAM setup copy).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 08:39:59 +02:00
Jonas Bark
419d23d74f fix(paywall): stop stretching plan cards against an unbounded height
The plan Row sits in a Column inside the sheet's scroll view, so its cross
axis is unbounded — CrossAxisAlignment.stretch then hands each card an
infinite height and layout dies mid-frame ('BoxConstraints forces an
infinite height', then the drawer paints un-laid-out boxes as 'RenderBox
was not laid out'). IntrinsicHeight bounds the row to its tallest card so
stretch can still equalise them.

Also reverts SelectableCard's Stack to the default loose fit: passing
constraints through risked the same unbounded-height crash in every
scrolling drawer that uses it, and the onboarding grid it was added for
now has its own tile widget. A test renders both inside a scroll view.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 08:17:09 +02:00
Jonas Bark
ddf220807a fix(paywall): lighter plan titles, smaller price, drop the redundant monthly line
Titles go w800 -> w600 and the price line 19 -> 17, so the cards read as
options rather than headlines. The monthly card's 'Billed at 2,99 €/mo.'
repeated its own price line and is gone; the plan row now stretches both
cards to one height so dropping it doesn't leave a ragged edge (the card
Stack passes the row's constraints through). Base card padding 12 -> 7.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 08:08:01 +02:00
Jonas Bark
7660e5fa47 fix(paywall): currency symbol instead of ISO code, smaller radio, lighter Base card
NumberFormat.currency(name:) prints 'EUR 2,08' — the per-month figure now
takes its symbol from the store's own formatted price (falling back to
simpleCurrency), extracted as testable paywallFormatPrice. The selection
radio was 28px on cards that are 17px-titled; it's 20px now. The Base
card's title drops from w800 to w500 so it reads as the quiet option.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 08:00:45 +02:00
Jonas Bark
063a3f4055 fix(paywall): one-line plan titles and legal links, per-month price first, quieter Base card
- Plan titles and prices shrink to fit rather than wrapping, so German
  'Monatlich' stays on one line.
- The per-month figure now leads each card with 'Billed at …/yr.' beneath
  it, matching the design; the monthly card's price line was blank
  whenever its store product resolved.
- Terms of Use / Privacy Policy sit on one line at any width.
- The one-time Base card is white with a hairline border, so it reads as
  the quieter option next to the Pro plans.
- Windows/Stripe fallback strings shortened to fit those single lines.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 07:52:22 +02:00
Jonas Bark
0ce4e9d6dd fix(paywall): mobile layout — icon, tighter type, padded value columns, side-by-side plans
- The BikeControl icon heads the sheet.
- Comparison table type scaled down (labels 16→13.5, header 18→14, values
  14→12, marks 28→22) so a phone shows the table without shouting.
- The Full/Pro value columns ran flush to the sheet edge, so long values
  like 'Unbegrenzt' touched it — they're now padded and slightly narrower.
- Yearly is always the preselected plan, and Yearly/Monthly stay side by
  side on narrow phones instead of stacking (they're a comparison).
- Terms of Use | Privacy Policy overflowed: smaller, underlined, wrapping.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 07:42:22 +02:00
Jonas Bark
c00c699488 feat(onboarding): offer a waiting update before setup starts
Extracts AppTitle's private update logic into lib/services/app_update.dart
(Shorebird patch first, then the platform store) so the title bar and the
wizard share one definition of 'an update is available' and one way to
apply it. The wizard shows it on the mobile welcome screen, or on desktop's
step 1 where there is no welcome screen — never twice.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 07:38:37 +02:00
Jonas Bark
45b214b095 feat(iap): show the in-app paywall on iOS and Android too, with real store prices
Riders see the Flutter paywall on every platform now — RevenueCat's hosted
sheet is only a fallback when an offering has no matching package. Its
price loader was gated to macOS, so mobile would have shown the hardcoded
'About 2.25 $/mo' placeholders; it now fetches offerings wherever
RevenueCat is in use (the Windows Stripe build keeps the fallback, having
no offerings to read). Purchases still go straight to the store via the
paywall's own buttons (fromPaywall: true).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 07:32:32 +02:00
Jonas Bark
120a810628 feat(onboarding): mobile welcome screen, theme-aware accent, honest VS copy, platform-correct paywall
- Mobile opens on a welcome screen whose headline reveals word by word,
  then the subtitle, the three what-you'll-do rows and the actions.
  'I'll set this up later' records completion, so a rider who declines
  isn't asked again on every launch. Desktop keeps its rail-framed step 1.
- Dark mode: colorScheme.primary is only the brand blue in the LIGHT
  theme, so white-on-primary icons and check marks were invisible (the
  Network tile above all). New onboardingAccent()/onboardingOnAccent keep
  the brand accent in both themes, lightened for dark.
- Step 4's blocked state read as 'Virtual Shifting doesn't work here'; it
  now leads with 'Optional: connect your smart trainer' and says plainly
  that VS does work — just not with both apps on one phone. The normal
  step regains the design's 'Optional:' prefix too.
- 'See Pro & Base options' goes through IAPManager again, so iOS/Android
  get RevenueCat's hosted paywall instead of the desktop fallback with
  placeholder 'about x €' prices (_loadRevenueCatPricing is macOS-only).
  The desktop paywall keeps pull-to-dismiss, now for every caller.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 23:52:44 +02:00
jonas.bark@gmx.de
5d16ab6cb5 fix: two BikeControl installs no longer overwrite each other in trainer apps
Running BikeControl on a second device made the one next to the trainer app
unreachable. Each install now advertises its own identity.

Because that identity changes, an app that was already paired will ask to
pair once more.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 15:38:46 +02:00
Jonas Bark
b0f7779562 fix(onboarding): only offer Local when the trainer app runs on this device
The Local method drives the app on THIS device, so offering it for an
'On another device' target (Rouvy on a PC, say) made no sense. Visibility
now mirrors CoreLogic.showLocalControl's target check, the mirror image of
the Bluetooth tile's rule, with a test pinning both.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 14:59:02 +02:00
jonas.bark@gmx.de
7e58213dc2 chore: drop the mDNS query listing from diagnostics
It was added while chasing the network discovery problem and is not useful
now that the cause is fixed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 14:44:01 +02:00
jonas.bark@gmx.de
599e2e644d fix: let trainer apps on the network find BikeControl again
Retires the Windows IPv6 workaround instructions along with it — they no
longer apply.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 14:33:34 +02:00
Jonas Bark
9822e1e5b9 feat(onboarding): explain the MyWhoosh-on-Android virtual-shifting limitation
MyWhoosh on Android only pairs trainers over Bluetooth, and BikeControl
can't advertise BLE to an app on the same device — so a bridge on that
device is unreachable. Step 4 now replaces the trainer list with the
reason plus the two setups that do work (move MyWhoosh to another device
for the Wi-Fi bridge, or run BikeControl on a second device and bridge
over Bluetooth), keeping the 'Let MyWhoosh handle Virtual Shifting'
footer. The step body takes the condition as an explicit parameter so the
screen is snapshot-testable off-Android.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 14:27:49 +02:00
Jonas Bark
d92fcb766b fix: re-check scan permissions when a device connects or the app resumes
ScanWidget captured its requirement list once at mount — the onboarding
wizard then granted permissions while the home screen sat behind its
route, leaving a stale 'permissions required' card after finishing (a
controller being connected proves the permissions are fine). Also
re-checks on app resume for grants made in system settings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 11:50:56 +02:00
Jonas Bark
d98483fa3b fix(click-v2): explainer auto-opens once per pair, right side stays off in left-only mode
The wizard's Click V2 auto-prompt marked 'the pair' by uniqueId before the
second side was even discovered, so two concurrent connectionStream runs
each opened the explainer — replaced with a single flag set synchronously
before the await (the row's Setup-needed button remains the way back in).

ZwiftClickV2RightSide.shouldAutoConnect now also requires unlock-with-
Zwift mode: after 'left side only' the right controller is deliberately
unused, and connecting it anyway burned battery and disturbed ClickLogic's
restart cycle. Covers both the auto-connect queue and ClickV2Onboarding's
_connectPending (connect() is a no-op while the gate is false).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 11:24:53 +02:00
Jonas Bark
323917d276 fix(onboarding): 'Setup needed' is a button that reopens the device sub-flow
The auto-prompt fires once per device, so a cancelled SRAM guided setup or
Click V2 explainer left no way back in. The row badge is now a small
button routing through the same _openSetupFor the auto-prompt uses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 10:53:31 +02:00
Jonas Bark
2a9ae6962b fix(onboarding): per-device contours under their rows, firmer pull-to-dismiss
Every connected controller with a layout renders its contour directly
below its own entry card (not just the first one). Sheet pull-to-dismiss
now requires ~90px of accumulated pull past the scroll top (was: any
single overscroll pixel on clamping physics), resetting when the drag
ends or the list scrolls.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 10:50:33 +02:00
Jonas Bark
9f4f968b49 fix(onboarding): pull-down past scroll top dismisses the paywall sheet, X removed
shadcn's drawer dismiss is a raw vertical-drag GestureDetector, so inner
scrollables always win the gesture arena — the package has no scroll-aware
handoff. New SheetPullToDismiss bridges it: at the scrollable's top, a
continued downward drag (clamping overscroll or bouncing negative pixels)
closes the sheet. Reusable for any scrollable bottom sheet.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 10:42:43 +02:00