Commit Graph

422 Commits

Author SHA1 Message Date
Jonas Bark
fcd277e3ba fix(local-network): don't let a pre-Settings probe repopulate the cache
invalidate() cleared the cached status but did nothing about a probe already in
flight. That probe then completed and wrote its answer back — the answer from
before whatever prompted the invalidation.

The case that matters is the one invalidate() exists for: the user is told
Local Network is off, taps through to System Settings, grants it and comes back.
If a probe was in flight when they left, its stale "denied" lands afterwards and
becomes the cached truth, so the app still claims the permission is off.

Tag each probe with a generation, bump it in invalidate(), and only write the
cache when the generation is still current. Whoever is awaiting the stale probe
still gets its result — it just doesn't become the shared answer. invalidate()
also drops _inFlight now, so the next caller starts a fresh probe instead of
being handed the pre-invalidation one.

Found while chasing an intermittent test failure. That turned out to be an
unrelated ambient issue (a MissingPluginException on the app_links EventChannel
that attaches to whichever test is in flight, which already fails ten other
files), but the race it exposed here was real.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 09:07:18 +02:00
Jonas Bark
20788e46b6 fix(requirements): stop the permission sheet opening for a granted permission
Toggling the "Direct connection" card could wedge: the sheet opened for a
permission that was already granted, and then sat there, because PermissionList
only re-probes on app resume.

ConnectionMethod probed one requirement list, awaited, then re-read
`widget.requirements` on the far side of the gap:

    Future.wait(widget.requirements.map((e) => e.getStatus())).then((_) async {
      final notDone = widget.requirements.filter((e) => !e.status).toList();

The tiles build that list inside `build()`, so any rebuild in that window hands
back fresh objects whose mutable `status` is still false — and these tiles
rebuild on every isConnected/isStarted tick, plus onChange's own setState. The
probe result was read off objects that were never probed.

Capture the list once per operation instead. This was pre-existing and not
specific to Local Network: di2_ble_tile and openbikecontrol_ble_tile pass
getRemoteControlRequirements() the same way, so they had the same latent race.

Also hoist the requirement lists out of build() into State fields across the
five tiles, so a probed `status` is not discarded every frame.

Separately: LocalNetworkRequirement was only wired into the network tiles, so
onboarding, app start and scanning never checked it at all — every one of those
reads getScanRequirements(). Add it there for iOS and macOS. The list is
filtered to unsatisfied requirements, so it surfaces only on an actual denial.

Note for macOS: keyboard-control-only users will now see a Local Network prompt
they do not need. Accepted deliberately in favour of one list over a
platform-split.

The regression test drives the real race — gate the probe, force a rebuild
mid-flight, release — and fails with "Found 1 widget with type PermissionList"
without the capture fix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 08:55:04 +02:00
Jonas Bark
c4c48dff07 Merge remote-tracking branch 'origin/6.5' into 6.5 2026-08-21 08:03:17 +02:00
Jonas Bark
905c2641cd feat(ios/macos): detect the Local Network permission instead of failing silently
Denial of Apple's Local Network privacy permission is the most common cause of
"BikeControl can't see my trainer app" on iOS and macOS, and it fails
completely silently: Bonjour browses return nothing forever, advertisements
never leave the device, nothing throws. An app watching only for errors cannot
tell "permission is off" from "there is nothing out there".

Apple ships no authorization-status API for it (not iOS 14...26, not macOS
15...26), so the new local_network_permission plugin measures it: an NWListener
and an NWBrowser on _bikecontrol-preflight._tcp, then

  browser discovers the listener        -> granted
  kDNSServiceErr_PolicyDenied (-65570)  -> denied
  neither, before the deadline          -> unknown

unknown is a real outcome, not an error — a device with no usable network never
completes the round trip even when the permission is fine — so everything fails
open on it and only a positive denial blocks the user.

The probe *is* the request: the system prompt fires on the first Bonjour
operation, so there is no separate request step, and after the user answers,
System Settings is the only way back.

- LocalNetworkAccess caches the result (probes cost a real round trip while
  getStatus() runs on every tile mount, tap and resume) and collapses
  concurrent probes into one, since two listeners on the same service type
  would resolve each other.
- LocalNetworkRequirement gates the three LAN tiles: MyWhoosh Link, Zwift mDNS
  and OpenBikeControl mDNS. Suppressed in screenshot/demo mode like the rest.
- Diagnostics drop the old guess (inferred from whether a discovery scan
  returned anything, which could not tell denied from an empty LAN) for the
  measured local-network=granted|denied|unknown.
- _bikecontrol-preflight._tcp added to NSBonjourServices on both platforms;
  without it the browse fails for a reason unrelated to the permission.

The Xcode project deployment-target bumps (ios 13.0->15.0, macos 10.15->12.0)
are Flutter's own migration aligning project defaults with the Podfiles; they
happen on any first build.

Verified with real builds on both platforms, not just analysis: flutter build
macos --debug and flutter build ios --no-codesign both succeed, the framework
is linked in, and the preflight service type is present in both built
Info.plists. 35 tests cover the mapping, cache, concurrency and fail-open
behaviour.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 07:58:18 +02:00
Jonas Bark
8a2d83139b feat(trainer): cycle the bridge connection when the control protocol changes
Trainers latch their control session to the protocol live at connect
time, so a switch only takes real effect on a fresh connection (Jonas
verified on hardware via the manual Bridge disconnect/reconnect). Both
switch sites — the VS-options selector and the self-test verdict CTA —
now run ProxyDevice.reconnectUpstream(), which mirrors the
ConnectionCard cycle and waits for the reseeded definition. Inert picks
(same effective delivery) skip the cycle.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 15:33:57 +02:00
Jonas Bark
eed0651cd8 test(self-test): drain FTMS control-grant timer in single-protocol selector test
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 15:17:09 +02:00
Jonas Bark
253cc0557b Merge self-test: resistance self-test + control-protocol delivery toggle
# Conflicts:
#	prop
2026-08-20 15:15:45 +02:00
Jonas Bark
1d1a0dbf72 feat(click v2): keep the right puck awake, and say when it can't
The right puck switches itself off after a minute of not being used.
BikeControl now prevents that on its own, with no button to press. The
sequence lives in prop; this side supplies what only it knows and shows
the rider the one case they can fix.

- the gate reads raw adverts, not the device list: the sibling only has
  to be nearby, and a left puck the rider ignored — every left puck in
  right-side-only mode — still counts. Discovery is also the retrigger,
  since an ignored puck never completes a handshake
- an optional step on the controller card, and a note on the right puck's
  own card, when no left puck is in range. An offer, never a blocker
- drops the D-pad line from "use the right side only"

Fixes a related bug: the controller link counted every undone step,
optional or not, so an optional offer alone turned a working controller
amber and held back "Ready to ride". The other two links already
excluded optional steps.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 14:55:15 +02:00
Jonas Bark
e1703b6f59 fix(self-test): surface precheck refusals on reruns; drop unused import
- self_test_card.dart: a precheck refusal on "Run again" now clears
  _engine inside the same setState. _body only renders _idle (where
  _refusal is shown) when _engine is null, so a refusal raised while a
  finished verdict engine was still attached rendered invisibly behind
  the verdict view — the rerun CTA silently no-opped.
- settings.dart: add missing static to _selfTestKey, matching its
  sibling key helpers.
- self_test_harness_test.dart: drop unused self_test_harness.dart import.

Adds a widget test: complete a run to a verdict, attach the trainer
app, tap "Run again" — the trainer-app refusal is now visible and no
new run starts.
2026-08-20 14:52:04 +02:00
Jonas Bark
e6407714a9 feat(self-test): offer switching the control protocol from the verdict
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 14:16:55 +02:00
Jonas Bark
0191fcc990 feat(trainer): control-protocol selector in VS options, persisted per trainer
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 13:38:32 +02:00
Jonas Bark
331b864e15 feat(self-test): verdict CTAs — overlay reveal, mode switch, support hand-off
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 13:11:42 +02:00
Jonas Bark
d53a063ab8 feat(self-test): SelfTestCard with guided run flow on the trainer page
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 12:32:03 +02:00
Jonas Bark
757faff42d feat(diagnostics): proto, vsMode, ftms caps, lastCtl and selfTest on the trainer bundle line
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 12:06:37 +02:00
Jonas Bark
16038c9ffc fix(self-test): bound headroom loop, ERG-safe skip path, hardened restores
Three ways the engine could strand a rider. The headroom loop spun forever
on a small gear range (maxGear is configurable down to 1) or against a
trainer that refuses to shift, so it now stops when the gear stops moving
and is capped either way. The power-target-less skip path returned before
the phase's finally, so a rider's manual ERG survived into the sweep —
pinning plateau 1 flat — and was then silently dropped by the first
shift; the check moved inside the try, and both ERG helpers now key off
the trainer's actual mode rather than only our own writes. Restores are
individually guarded: a refused gear write can no longer cost the rider
their ERG session, a refused ERG write no longer downgrades a scored run
to aborted, and run() resolves with a result whatever the harness does.

Also: a mid-test upstream dropout now aborts instead of misreporting
NO_CONTROL — prop's notifiers latch their last value, so a dead link used
to read as a trainer that ignores us.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 11:46:16 +02:00
Jonas Bark
da3f3931ee Merge branch 'fix/ios-live-activity-target-max' into 6.4 2026-08-20 11:33:28 +02:00
Jonas Bark
631159defd fix(self-test): shift sweep always runs in SIM; rider ERG restored at finish
Restoring a rider's manual ERG target right after the staircase pinned
power flat for the whole shift sweep, so every transition read "no
change" and a healthy trainer verdicted ERG_OK_VS_FAIL. The staircase now
always exits ERG before the sweep, and the rider's own ERG session is put
back at the very end — still gated on the dirty flag, so a run that never
commanded a target (noData, early abort) writes nothing at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 11:20:35 +02:00
Jonas Bark
16ec79793e feat(self-test): SelfTestEngine state machine with verdict matrix
Baseline → ERG staircase → shift sweep on a 500 ms tick, with a cadence
pause watchdog and restore-always semantics: the gear goes back to where
the rider left it and our own ERG writes are undone on pass, fail, cancel
and exception alike. Eight scenarios drive it on a virtual clock through
a fake harness, so no test waits on wall time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 11:16:32 +02:00
Jonas Bark
b85264369a fix(overlay/ios): reuse the Live Activity instead of orphaning one per ride
A rider's diagnostics (iOS 26.6, 6.4.3) carried this four times inside a
minute, with "virtual shifting isn't working" attached:

  PlatformException(LIVE_ACTIVITY_ERROR, can't launch live activity,
  Maximum number of activities for target already exists)

That is ActivityKit's `targetMaximumExceeded`. On iOS the Live Activity IS
the gear overlay — the only place a rider can read BikeControl's virtual
gear, because trainer apps never show it — so once it fires the readout is
dead until the phone reboots.

show() minted a fresh random activity name and called createActivity every
time, and the id it got back lived only in this isolate's memory. Every
force-quit, engine restart or swiped-away activity therefore left an
activity behind that still held one of ActivityKit's per-target slots, and
nothing ever went looking for it. After enough rides the target is full and
every request throws.

- Query what iOS actually holds, adopt the one activity that is still
  live (updateActivity writes under its own attributes prefix, so an
  activity from a previous launch picks up fresh gear data), and end
  everything else before requesting anything.
- Collapse overlapping show() calls onto one in-flight future, so a
  trainer app flapping its connection can't queue up requests.
- Retry once after sweeping everything when the request still throws:
  `Activity.activities` reads empty for a beat after a cold start, which
  the plugin works around the same way in createOrUpdateActivity.
- Ask for removeWhenAppIsKilled so a graceful termination frees the slot.
- Use a stable activity name, which also stops each ride from leaking a
  new set of never-collected App Group UserDefaults keys.
- A show() that starts nothing now reports isShowing == false, instead of
  leaving the Overlay switch and the auto-show guard claiming an overlay
  the rider cannot see.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 11:07:00 +02:00
Jonas Bark
514c396e5d feat(diagnostics): call out an active VPN on its own line
A user on iOS reported "MyWhoosh sees BikeControl but won't pair". Their
bundle looked healthy end to end: the advertisement was on the right
interface, our own mDNS record came back on the discovery scan, local
network permission was fine, both TCP servers were listening. The only
trace of the actual cause was a "(virtual)" suffix on one of three
interface rows: utun4/10.2.0.2. Turning the VPN off fixed it.

That asymmetry is the norm, not a fluke. mDNS is multicast and is not
carried into the tunnel, so discovery keeps working; the unicast TCP
connection that follows is the part a full-tunnel VPN swallows. Every
other line in the block therefore reads green.

Give it a line of its own, prefixed "VPN", so support sees it at a
glance instead of decoding scores. Only interfaces that carry a routable
IPv4 count -- Apple platforms always keep several idle utun devices
around for Private Relay / Continuity / Wi-Fi Calling, and those have no
IPv4 at all, so they never reach the candidate list. Names are matched
case-insensitively and partly as substrings because Dart reports the
adapter FriendlyName on Windows ("NordLynx", "ProtonVPN TUN"), where
prefix matching would miss nearly every VPN. Mesh VPNs handing out
100.64/10 are named but marked usually harmless: they route their own
overlay and leave the LAN path alone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 11:04:37 +02:00
Jonas Bark
f6eab0eead feat(self-test): per-trainer result persistence and FitnessBikeHarness 2026-08-20 10:57:12 +02:00
Jonas Bark
f0c3a74050 feat(self-test): SelfTestResult model with bundle string and json roundtrip 2026-08-20 10:45:35 +02:00
Jonas Bark
47ed186ced feat(auth): put email sign-in below the social buttons
The social logins are what most riders reach for, so they lead; the emailed
code is the fallback and now sits under the "or" divider. Covered by a test
asserting the form renders below the last social button, so the order cannot
drift back unnoticed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 09:04:54 +02:00
Jonas Bark
2eca5d4178 feat(auth): sign in with an emailed six-digit code
Riders without a Google, Apple, GitHub or Facebook account can now sign in
with their email address: Supabase mails a six-digit code and EmailLoginForm
redeems it via verifyOTP.

Deliberately code-only rather than a clickable magic link — a link has to
travel back through bikecontrol://, which is unreliable on Windows and Linux,
and corporate mail scanners routinely open (and thereby burn) one-shot links
before the rider ever sees the message. A typed code behaves the same on every
platform, including web.

The Supabase side is the send-auth-email hook in the website repo, which
renders the branded BikeControl mail through Resend.

Also folds the pop/onBack block that was duplicated across all four OAuth
handlers into _afterSignIn(), which adds the mounted guard those calls were
missing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 08:52:34 +02:00
Jonas Bark
7f3e696356 test(paywall): cover opening "Go Pro" from a DrawerOverlay-less context
Locks in the fallback added with 2c7b18f4. openDrawer needs a DrawerOverlay
ancestor and does `parentLayer!` in release, so a caller passing a context
from above its own Scaffold used to turn "Go Pro" into a bare "Null check
operator used on a null value" toast with no paywall -- and on an expired
trial, no way forward.

Two cases: a Scaffold-less tree (the shape the onboarding trainer picker
hit) must still render the paywall, and a tree with a Scaffold must still
get the drawer, so the dialog fallback can't quietly become the only path.
SheetPullToDismiss is drawer-only, which is what tells the two branches
apart. The no-DrawerOverlay test asserts DrawerOverlay.maybeFind is null
first, so it can't silently stop reproducing the bad context.

Verified by reverting the fallback: the first test fails, and passes again
once restored.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 07:37:43 +02:00
Jonas Bark
a58edfbb2c test(snapshots): the Local tutorial's entry point, mouse editor and Android list
Three more shots for the Local connection tutorial, and the harness knob one of
them needed:

  - the trainer app card on the main page, which is where a rider actually
    opens Trainer Connections from ("Edit"), built from the real chain via
    buildChain rather than a hand-made ChainLink;
  - the placement editor over an in-game screenshot, with a click target on
    MyWhoosh's on-screen gear arrows;
  - the button editor as Android renders it: no keyboard row, but system
    actions, the assistant and a custom broadcast intent.

captureWidget gains an optional `height`. Without one nothing changes: the
widget still gets unbounded height inside a scroll view. With one, the surface
becomes exactly width x height and the scroll view is dropped — a full-screen
page can't live inside another viewport, and the touch-area editor in
particular maps percentage positions against MediaQuery, so it has to be
rendered at the size it reports.

The touch-area shot needs a little more staging than the others: path_provider
and window_manager are mocked (no plugin registrant runs under `flutter test`,
so path_provider falls back to its base method channel), the display size is
pinned to the surface so the notch compensation nets to zero, and it renders
with settle: false because that page never comes to rest.

`pinApp()` before each capture: registering a button a shipped keymap doesn't
have copies that keymap into a profile of its own, so the handler's app drifts
away from the one the test is editing — which the touch-area editor notices,
because it reads the keymap off the handler rather than taking it as a
parameter.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 20:59:27 +02:00
Jonas Bark
40a114b913 test: housekeeping
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 20:23:17 +02:00
Jonas Bark
b80107b358 test(snapshots): capture the Local connection method for the blog tutorial
Eight widget snapshots the Local connection tutorial on the website is built
from: the target picker, the Local tile, the keyboard-permission sheet, the
mapping table before and after editing, the button editor with a keyboard
shortcut and with a mouse click, and the press-a-key dialog.

Two departures from the usual snapshot setup, both needed for a tutorial
rather than a store board:

  - screenshotMode is turned back off, because the marketing renders
    anonymize the trainer app to "Trainer app" and hide permission rows —
    a tutorial needs the names and the rows the reader will actually see;
  - the framework's target platform is pinned to macOS per test. The harness
    renders Android-like by default, which grew Android-only cards (system
    actions, assistant) on what is otherwise a macOS render. The reset has to
    happen inside the test body: the binding checks that no debug variable
    changed *before* tearDowns run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 20:03:53 +02:00
Jonas Bark
50ac4379ba fix(trainer): the bridge presents its own services and never waits on the trainer 2026-08-18 18:44:07 +02:00
Jonas Bark
8170cd97b9 fix(trainingpeaks): direction and face buttons now reach the app
The TPV profile mapped navigationUp and the coloured face buttons to a
keyboard key / touch position only. _handleDirectConnect forwards a KeyPair
solely when it carries an inGameAction, so those presses never left the
phone — and an actionless default is worse than no default at all, because
it shadows the action the button would otherwise inherit from
ControllerButton.action via Keymap.addNewButtons (which is exactly why
navigationDown, absent from the profile, worked).

Same gap hit the HUD-toggle and difficulty defaults. Steer Left/Right are
added to defaultObpSupportedButtons as well: TPV advertises them in its
live app-info frame, but without them the button editor hid steering
before a connection.

Reported by a rider on Android with TPV on an iPad, whose log showed
"Sent Down button press" next to "No connection method active".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 12:54:00 +02:00
Jonas Bark
12b51447a3 fix: sending a screenshot without text no longer crashes
SupportComposer._submit caught the send failure to restore the text and
the staged attachment, then rethrew. The send button drops the returned
Future, so that rethrow escaped into the zone as an unhandled error and
was reported as "App crashed".

- _submit is terminal now, and the button invokes it via unawaited() so
  no Future is silently dropped. The page-level rethrows stay: they are
  how the composer learns it must restore.
- The page-level send catches forward through recordError
  ('support.chat.send') — this path had no crash reporting at all.
- Interim client mitigation for image-only messages: substitute a
  localized placeholder body when the body is empty but an attachment is
  present, since the send-support-message edge function still rejects an
  empty body.
- A failed send no longer orphans the uploaded blob: the successful
  upload is retained against the staged attachment the composer restores,
  so a retry re-uses it instead of uploading a second copy (there is no
  client-side delete for the attachment bucket).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-17 13:14:18 +02:00
Jonas Bark
ff9671bfc5 fix: no crash on button press when no keymap is set
The keymap ('app') and the trainer app ('trainer_app') are independent
prefs. When the keymap one is missing while a trainer app is selected,
actionHandler.supportedApp stays null — every button press then threw
"Null check operator used on a null value" and the device registered no
buttons at all, so the SRAM edit screen came up empty.

- RemoteActions/DesktopActions/AndroidActions no longer dereference
  supportedApp (or getKeyPair) with `!`; they return the same
  noKeymapSet / noActionAssigned Error BaseActions already produces.
- Fall back to the selected trainer app when the keymap pref can't be
  resolved (initializeActions, Settings.init, deleteCustomAppProfile).
- BaseDevice.getOrAddButton keeps the created button in availableButtons
  even without a keymap, so the device still renders its buttons.
- The OBC BLE/mDNS emulators evaluated connectedApp.value! before the
  null guard that follows, making the guard dead code — reordered.
- handleButtonsClicked now forwards through recordError, which is why
  this never showed up in crash reporting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-17 13:14:09 +02:00
Jonas Bark
7e3a48d162 feat(attribution): report the Play install referrer once per install
The referrer source is behind an interface so the reporting logic is unit
tested without the Play plugin, which needs a real device.

The done-flag is only written after a successful send, so a failed report
retries on the next launch instead of vanishing. A missing referrer still
reports, because an install with no attribution is still an install and the
organic baseline is what paid gets compared against.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-16 20:29:42 +02:00
Jonas Bark
5d4a00e96a fix(attribution): normalise malformed-referrer errors to FormatException
Uri.splitQueryString throws ArgumentError, not FormatException, for
malformed percent-encoding (e.g. a truncated '%' or invalid escape) --
verified against the project's Dart SDK. The doc comment and Task 3's
brief both promise FormatException so callers can catch a single type
and route it through recordError. Catch the mismatch and rethrow as
FormatException; add a test proving the contract holds.
2026-08-16 20:26:46 +02:00
Jonas Bark
89f8638797 feat(attribution): parse UTMs from a Play install referrer
Pure function, no plugin dependency, so it is fully unit tested. Keeps Play's
organic referrer rather than discarding it -- that is how paid and organic
installs get told apart.

Lets FormatException escape on malformed encoding so the caller can record it
rather than silently losing an install.
2026-08-16 20:22:02 +02:00
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
510a85ac20 Merge branch '6.4' of github.com:OpenBikeControl/bikecontrol into 6.4 2026-08-16 14:35:31 +02:00
Jonas Bark
1a3fea5fa6 fix instructions 2026-08-16 14:35:27 +02:00
Jonas Bark
4df41bdece fix(rouvy): keep the bridge connection stable 2026-08-16 14:13:09 +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
55d35b0add fix(rouvy): restore Virtual Shifting on the bridged trainer 2026-08-16 12:44:23 +02:00
Jonas Bark
27462b1c58 fix(rouvy): adjust the bridge's advertised services 2026-08-16 12:44:22 +02:00
Jonas Bark
a8c18633e0 fix(store): show a finished setup on the home board, and stop the corner eating the status bar
Four things the first pass got wrong.

The home screen is the first board on the listing, and it was advertising
an unconfigured app: an amber "3 steps left — Controller & Trainer app
still need setting up" banner, nine controller cards (the set the card
goldens further down need, not a rider's bars), a steering gauge reading
"Calibrating…" where the Click V2's contour belongs, and an "Unlock it
with Zwift" card. The scene now runs with one controller — the Click V2,
which `screenshotMode` already shows as "Controller" — its unlock-mode
choice made and its unlock persisted, the trainer bridged and the
MyWhoosh Link connected. Every one of those buys off a step the home
chain was counting, so the banner is green and the controller card draws
its contour.

The device's corner radius was a fraction of the viewport WIDTH, which is
fine on a portrait phone and wrong on a landscape tablet: 78 logical
units on the 917-wide iPad viewport, where golden_screenshot's status bar
image puts the battery 23 units in from the right. It ate the battery.
Radius and bezel now scale off the viewport's SHORT side — a bezel is a
physical property of the device, not of the orientation it is held in —
and phones and tablets get their own radius fractions, because a real
phone is dramatically rounder than a real tablet. store_board_test.dart
holds every slot's corner arc clear of that status bar corner, with the
insets measured off the package's own topbar assets.

Version to 6.4.2+146, which the boards print in the overview header — the
fixture was still claiming 6.1.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:09:42 +02:00
Jonas Bark
b805019ec7 feat(store): refresh the App Store / Play Store screenshot boards
Ports the marketing board BikeOtter moved to, onto the slots and scenes
this project already emits. The board is now written entirely in
fractions of the canvas — the five board slots are 440x956, 414x896,
1280x800, 917x688 and 853x533 logical, so anything in pixels lands
somewhere different on each.

The look:
  * gradient corner to corner instead of straight down, so the board has
    a light side and a dark side rather than a horizon;
  * a white radial glow under everything — the falloff is what makes it
    read, so it holds better than half its strength through the inner
    half before dropping;
  * the device tilted -3 degrees, with the rotation's overhang taken off
    the top so the painted top edge still lands at the band foot (a
    Transform resizes nothing);
  * the bezel as padding rather than a foregroundDecoration border,
    which used to eat 8 logical px of app on every edge and clip the app
    bar at tablet width; plus a drop shadow and a bottom bleed, so the
    board reads as a product shot;
  * one accent phrase per headline in a light cyan from the brand
    family — always the subject of the claim, never the verb;
  * a 24-degree hue ramp across the listing, so six boards read as a
    series instead of one image repeated.

Marketing copy and the brand style move to test/store_copy.dart, and the
slot table to custom_frame.dart, so the new board tests can read both
without booting the app. Two French headlines were shortened to fit the
character cap.

test/store_board_test.dart asserts the composition arithmetically on
every slot — the goldens are generated on demand and the suite that
writes them is tagged out of a normal run, so nothing else looks at the
layout, and its failure mode is silent.

Note: regenerating also picked up app-content drift on the `device`
scene (the "3 steps left" banner, a Calibrating gauge and the "Unlock it
with Zwift" card). That is the redesigned home screen reacting to the
marketing fixture's state, not the board change, and still needs a
decision on what that scene should feature.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 13:19:47 +02:00
Jonas Bark
9ade43d060 feat: label WiFi vs Bluetooth trainer entries
The same physical trainer is regularly discovered twice — once over BLE
(MAC/UUID device id) and once over mDNS/DirCon (dircon://<serviceName>) —
and BluetoothDevice.== is id-based, so the two never dedupe. Both rows
carried the same name, the same "Supports virtual shifting" subtitle and
the same bike icon, leaving the rider to guess which one to tap.

Name the upstream transport wherever the duplicates surface:
- the onboarding trainer picker (both the scan rows and the already-
  connected card) now reads "<transport> · Supports virtual shifting"
  and leads with a wifi/bluetooth mark instead of the generic bike;
- ProxyDevice.nameBadge drops the exact-duplicate-name gate — real
  duplicates differ slightly (BLE advertisement vs DirCon service name),
  which is exactly the case the gate missed;
- the diagnostics bundle gains upstream=wifi|ble next to the existing
  mode= (which is the *downstream* retrofit mode, not the same thing);
- the home chain card ranks bridged > connected > connecting > idle so a
  live entry always beats its idle twin.

New reusable connectionWifi / connectionBluetooth l10n keys replace the
hardcoded 'WiFi'/'BT' strings in the connection card and the proxy
metric row.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 08:43:26 +02:00
Jonas Bark
f4c8aba982 feat: overlay hint when trainer app first connects
Nearly every MyWhoosh/Rouvy bridge rider pairs the virtual trainer, then
writes support asking why the gear shown in the trainer app doesn't sync
— trainer apps can't display BikeControl's virtual gears. Surface the
canonical answer (the gear overlay) exactly once, at the moment the
question would otherwise arise: the first time a trainer app connects to
the virtual trainer while the overlay is off.

- OverlayConnectHint fires an AlertNotification (toast + activity-log
  entry) whose button deep-links to the trainer detail page, scrolled to
  the Overlay section (new revealOverlaySection param).
- Hooked on ProxyDevice's device-level isConnected wrapper so it
  survives emulator/mode swaps; gated on an active VS session
  (fitnessBike != null), overlay disabled, and a persisted one-time
  flag (overlay_connect_hint_shown).
- New l10n strings in all six locales.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 14:06:24 +02:00
Jonas Bark
2b74a06141 feat: swipe between the Virtual Shifting preview scenes
The dots were the only way to steer the carousel by hand, and a stage that
animates on its own invites a swipe. Left goes forward, right goes back, both
wrap, and the stage follows the finger a little before it commits — a drag
too short to count springs back.

Also separates "pinned" from "reduced motion": screenshotMode still holds the
scene for deterministic captures, but reduced motion now only stops the stage
advancing by itself. Before this the dots did nothing at all with animations
off, which is exactly the setting where a rider needs to drive it themselves.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 09:03:54 +02:00
Jonas Bark
8023060121 fix(click-v2): unlock-with-Zwift folds the split entries back into one controller
Picking unlock-with-Zwift on the right puck's card updated the mode but left
the separate right-side entry connected, with no way back to the joined
controller. chooseUnlockWithZwift has never touched useNewUnlockMethod — the
only thing that could turn the split representation off was the "use new
unlock method" switch, and removing that switch (74bb2737) left the setting a
one-way door: chooseRightSideOnly turns it on, nothing turned it back off.

Make the mode own the representation, mirroring chooseRightSideOnly in the
other direction. Unlock-with-Zwift is the both-pucks mode and the unified
controller is both pucks as one device; the split exists so the RIGHT puck
can work alone, unlock free, which is the other mode. So the choice drops
every split instance, clears the scan cache and rescans: the left puck's
advert rebuilds as the unified controller and the right puck's builds nothing,
which is what removes the separate entry. The flag is set before
restoreLeftSides(), which can restart the scan and would otherwise rebuild the
very entry being folded away.

The unified controller's card carries the unlock-mode row now too. It only
ever rendered its unlock warnings, so landing on it would have been a trip
with no route back to right-side-only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 08:54:33 +02:00
Jonas Bark
bb5ce75375 feat: fourth Virtual Shifting preview scene — the rest of the features
A 2×2 grid for what doesn't need a picture: instant gear changes, the
Bluetooth-to-WiFi bridge, controller support and the adjustable gear count.
The one still scene — a rider reads it rather than watches it — with the row
heights tied together so the grid survives a translation wrapping.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 08:41:02 +02:00
Jonas Bark
67e405e6ad fix: name the Click V2 unlock mode, and say where unlocking happens
The card showed only "Entsperrmodus" and "Erneut einrichten", so it looked
identical whichever mode was set and coming back from the explainer read as
if the choice had done nothing. Name the mode that is actually set, modelled
as the three states the setup can rest in — unlock-with-Zwift, right-side-
only, and the legacy restart loop — resolved in one place so both pucks name
the same mode the same way.

The missing unlock option was real, too. unlockWarnings — which carries
"Jetzt freischalten" — is rendered only by the left puck and the legacy
unified controller, and returns nothing without a connection; the right puck
never carried it, correctly, since the left one is what Zwift locks. So in
Zwift mode with the left puck off, asleep or not yet rediscovered, the action
existed nowhere and the card sat silent. Point at the left controller in that
case instead. When it is connected nothing changes: the left card shows the
real unlock UI and the right card stays quiet.

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