Commit Graph

120 Commits

Author SHA1 Message Date
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
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
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
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
9960a33fea feat: animated Virtual Shifting preview in the trainer onboarding step
Replaces the three benefit tiles with a three-scene stage that shows what
Virtual Shifting does in the widgets it actually does it with, and rebuilds
the scan as its own card with the found trainers inside it.

- Scene 1 pairs smart trainers with the training apps BikeControl supports.
- Scene 2 drives the gear editor's own ratio curve through its presets, so
  GearRatioCurve is split into a definition-bound wrapper plus a value-driven
  GearRatioCurveView, and the presets move to gear_ratio_presets.dart where
  both the editor and the preview read them.
- Scene 3 introduces FrontShiftVisual (chainrings + resulting ratio range),
  which FrontShiftCard now shows above its teeth steppers in place of the
  bare ratio factor.

The stage holds still under reduced motion and screenshotMode, opening on
initialScene so each scene can be captured deterministically.

Also localizes the ratio curve's hardcoded labels and pluralizes the
"trainers found" count.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 08:00:06 +02:00
Jonas Bark
e34953cd32 get rid of vs onboarding 2026-08-11 19:25:41 +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
8b36722e43 feat(trainer): add "Help me decide" link to the connect mode picker
The picker asks the user to choose between BikeControl's virtual
shifting, a plain proxy, and letting the trainer app handle shifting
itself — without much to go on. Link out to the blog post that compares
the two paths honestly, so the trade-offs are one tap away.

Localized across all six locales. Also adds the snapshot test that
generates the picker image used in that post.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 23:52:09 +02:00
Jonas Bark
db5cc74a12 fix(erg,sram): shared ERG stepping with boundary guards; scope §7 guard to shifting-enabled; coalesce iOS echo presses
ERG (review findings on the ±5W change):
- New ErgPowerStepping extension is the single home for the 5W step and
  500W manual cap, replacing 7 inline copies (physical buttons, hero-card
  buttons/slider, three overlay controllers).
- Boundaries are guards, not clamps: up at >=500W is a no-op like the
  disabled UI button (a 600W FTMS target is no longer slashed to 500),
  down from >500W steps relative, and an unknown baseline (hub-commanded
  ERG reports no target) is a no-op with a new localized message instead
  of slamming the trainer to ~150W.
- ERG shift-up Success carries the button again so +5W presses show
  activity feedback (missed conversion from 843f7985).

SRAM gesture:
- Same-lever repeats inside the 90ms combo window coalesce as duplicates:
  a finger can't re-press in 90ms, but iOS re-delivers a colliding read
  response of the 0xFF edge through the notify callback — it must not
  actuate twice (nor break a combo when it misdecodes to the other lever).
- The §7 multishift guard only runs while shifting is enabled — the one
  state where a held paddle actually bursts (per c94b87f0's --observe
  capture). Bonded rapid tapping and both-lever combos are never
  throttled. Timer-driven instead of DateTime.now() (deterministic under
  fakeAsync) and cleared by _resetGesture on (re)connect.
- The "set up SRAM control" warning fires once per connection, not on
  every undecoded press.

Harness:
- EmulationSession.notify drops notifications for removed peripherals so
  delayed notifies (SRAM double-tap) can't land after teardown.
- The 0xFF press edge is SramAxsConstants.triggerEdge at all call sites;
  the emulation test waits on the named TRIGGER_UUID constant.
- New coverage: guard behavior through processCharacteristic in both
  states, burst suppression while unbonded, all-taps-delivered once
  bonded, ERG boundary/game-set-target cases.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:51:35 +02:00
Jonas Bark
b99d54f6ee screenshots, changelog adjustments 2026-06-30 09:51:46 +02:00
Jonas Bark
9116688d63 fix(shifting): apply front-derailleur settings live; bound chainrings; handle combo errors
- FrontShiftCard now applies its toggle/chainring changes to the live
  FitnessBikeDefinition (not just the persisted config), so enabling the
  virtual front derailleur takes effect immediately instead of only after a
  reconnect/mode-switch — the combo gate read the config while the action
  checked the def, so the just-enabled feature reported itself disabled.
- Bound the small-ring stepper to the large ring so small can't exceed large
  (which inverted the ratio and made the shift a no-op).
- Error-handle the fire-and-forget front-shift combo so a throw is recorded
  instead of becoming an unobserved async error.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 19:58:26 +02:00
Jonas Bark
72d9407b53 test(screenshot): blog widget snapshots for the front derailleur
Extract FrontShiftCard from the gear-ratios page so it can render in
isolation, and add two golden scenes that capture single widgets for the
6.2 blog: the front-derailleur setting card and the second-window gear
overlay (2×N notation). Each renders the widget in a keyed RepaintBoundary
for a tight, page-free capture.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 15:57:49 +02:00
Jonas Bark
ff57b005d5 feat(shifting): show 2×N gear position when the front derailleur is active
With the virtual front derailleur on, the compact gear readout switches
from rear gear/total (14/25) to head-unit-style front×rear position
notation (small ring 1×N, large ring 2×N, e.g. 2×14) — matching how
Garmin/Wahoo display Di2/AXS gearing. With it off, it stays 14/25.

- Add tested formatGearReadout helper.
- Wire into the proxy card, debug menu, desktop second window + Android
  PiP/overlay (trainer_overlay_view), and the gear hero card (2× · 50T).
- Carry frontShiftEnabled + frontRingLarge through TrainerOverlayState
  (json, ==, hashCode, activity map) so the snapshot reaches the overlay
  and the iOS surfaces.
- iOS PiP + Live Activity: format 2×N centrally in GearSnapshot.
- Standardize the off-state readout to 14/25 across all surfaces.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 15:02:40 +02:00
Jonas Bark
b60876e6dd feat(pip): opt-in on Dynamic-Island iPhones + immediate floating window on iPad
- New "Floating window (Picture-in-Picture)" overlay setting (iOS 16+). Default
  follows the per-device auto behavior (on for iPad / non-DI iPhones, off for
  Dynamic-Island iPhones); DI-iPhone users can opt in. The Live Activity keeps
  running alongside it (additive).
- iPad: start PiP immediately on activation (foreground) instead of only when
  backgrounded — there's screen room (DeviceCapabilities.prefersForegroundPip +
  scheduleForegroundStart poll).
- DeviceCapabilities.isPipCapable (any iOS 16+ PiP device) + bike_control/pip_ios
  "isCapable"; settings.getOverlayUsePip/setOverlayUsePip; show() resolves the
  preference.
- requiresLinearPlayback = true to drop the PiP skip/scrub (next/prev) controls
  (it's a live HUD; central play/pause is system chrome, harmless no-op).
- overlayUsePip + overlayUsePipSubtitle in all 6 languages; changelog updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 18:50:33 +02:00
Jonas Bark
99618d1565 feat: show active front chainring on gear hero card
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 16:52:56 +02:00
Jonas Bark
798ea25bc1 feat: front-shift config UI (enable + chainring teeth)
Add SRAM-style front-shift card to gear-ratios editor: enable toggle bound
to frontShiftEnabled, small/large chainring StepperControls clamped to
ShiftingConfig constants, derived ratio helper text. Persists via
_updateActive copyWith. Localized in all six ARBs (en/de/es/fr/it/pl).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 16:49:19 +02:00
Jonas Bark
b201cb3e53 Generate localized store screenshots (golden_screenshot 11)
- Bump golden_screenshot 8.2.0 -> ^11.0.1 (drops the Yaru dependency, hence the
  linux plugin-registrant change).
- screenshot_test.dart now renders each scene for 6 locales (en/de/es/fr/it/pl)
  via a shoot() helper, writing screenshots/<locale>/<scene>-<device>.png.
  Marketing titles are translated per locale (de/es/fr/it/pl are drafts).
  - main.dart: screenshotLocale global drives the app locale in screenshot mode
    (was hardcoded to English).
  - v11 only loads fonts found in the rendered tree, so loadAssets() runs after
    the first pump.
- Virtual Shifting scene shows the gear UI instead of the "trainer doesn't
  advertise FTMS" warning: added ProxyDevice.debugAttachFitnessBike (test seam,
  no server side-effects) and hide the MyWhoosh gearing hint in screenshot mode.
- prepare_store_screenshots.sh maps each store locale from its language folder
  (de-DE <- screenshots/de, ...).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 11:22:56 +02:00
Jonas Bark
fb84ffbcf1 Merge remote-tracking branch 'origin/6.0.0' into custom-mdns-responder
# Conflicts:
#	lib/bluetooth/devices/openbikecontrol/obc_mdns_emulator.dart
2026-06-11 21:56:19 +02:00
Jonas Bark
5430fa129c Add 'More Information' blog link to Virtual Shifting intro
Link the 5.4 smart-trainers/virtual-shifting blog post as a secondary
'More Information' action above 'Got it', reusing the existing moreInformation
string (all 6 locales).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 20:37:41 +02:00
Jonas Bark
22e09bc246 Add first-run Virtual Shifting beta intro on Smart Trainer page
Show a one-time, full-screen explainer the first time the Smart Trainer
page is opened: Virtual Shifting is in beta, works with dozens of trainers
(some not perfectly yet), links to the supported-trainers list, and invites
feedback. Gated by a global 'virtual_shifting_intro_seen' pref and skipped in
screenshot mode. Reuses existing icons only. Strings added in all 6 locales.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 20:35:36 +02:00
Jonas Bark
0d612ce032 Re-attach connection listeners on in-place reconnect
After an in-place "No connection" disconnect, selecting Virtual Shifting
again reconnected the BLE upstream but the connect never completed:
device.isConnected stayed false and the card hung on "connecting".

The listener that flips isConnected (and drives the handshake to
completion) is created only in _connect(), which runs once via the
auto-connect queue at app start. The first manual connect reuses that
listener; disconnect cancels it (so a BLE drop doesn't fire
auto-reconnect); the second manual connect via startProxy() had no
listener and never re-ran _connect.

Route the in-place reconnect through a new Connection.connectDevice()
wrapper over _connect, re-attaching the action / connection-state
listeners — the same path the working auto-connect uses — instead of
calling ProxyDevice.startProxy() directly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 14:39:10 +02:00
Jonas Bark
0db8cf0c31 Keep the device registered on in-place "No connection" disconnect
The "No connection" picker entry disconnects without leaving the details
page, but Connection.disconnect(forget: false) removed the ProxyDevice
from the registry (isResetting is false). The open page kept the now
orphaned object: rediscovery built a *new* ProxyDevice while the page
still pointed at the old one, so selecting Virtual Shifting again
reconnected a device absent from bluetoothDevices — its BLE notifications
were rejected ("Device not found") and the connection was force-dropped.

Add a keepInList flag to disconnect; the in-place "No connection" path
passes it so the same device object stays registered (and its scan
result is retained to avoid a churned duplicate) and remains
reconnectable on the same card. The Disconnect buttons, which pop the
page, keep the default removing behaviour.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 14:14:48 +02:00
Jonas Bark
60817dabee Smart Trainer card: stable keys, reconnect rebinding, awaited mDNS stop, No-connection UX
- ConnectionCard: "No connection" shows "Not connected" instead of the
  bridge connect instruction; switching modes keeps the bridge accordion
  mounted with inline progress (drops the "Connecting in ... mode"
  placeholder card).
- proxy_device_details: stable keys on ConnectionCard / LiveMetricsSection
  / MiniWorkoutCard. On (dis)connect, conditional siblings toggle both
  above (FTMS warning) and below (gear/settings/VS-notice) these widgets,
  trapping the unkeyed ones in Flutter's reconciliation middle and
  remounting them — which collapsed the accordion and rebuilt the page.
- ProxyDevice: re-establish the emulator-state bindings on every
  (re)connect (_rebindEmulatorState in startProxy). The in-place
  "No connection" disconnect detaches them on a reused ProxyDevice, so
  reconnecting Virtual Shifting left the UI stuck on "connecting" while
  the emulator was actually connected.
- ProxyDevice.disconnect/switchRetrofitMode/handleServices: await the
  emulator stops so mDNS/TCP is torn down before reporting disconnected,
  and log the previously swallowed detach errors.
- connection.dart: log the discovered device name instead of its runtime
  type.
- Bump prop for the awaited mDNS teardown.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 14:06:12 +02:00
Jonas Bark
e79edf4809 UI adjustments 2026-06-10 08:53:30 +02:00
Jonas Bark
0a76de870a refactor: ProxyDevice owns trainer identity and def construction
handleServices builds both ProxyBikeDefinition and
FitnessBikeDefinition up front and attaches to the right emulator
based on retrofit mode. ProxyDevice provides advertisementName +
mdnsTxt to ftmsEmulator/_proxyEmulator via the new startServer
parameters. Drops DirconEmulator state mirroring that's no longer
needed. ZwiftClickV2 no longer calls startServer (click-alone
path removed per prop strip). UI consumers route through
ProxyDevice.advertisementName and device.retrofitMode.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 00:08:33 +02:00
Jonas Bark
4956067764 fix: use device.fitnessBike in live_metrics_section
Missed in the main refactor commit — live_metrics_section was still
accessing device.emulator.fitnessBike directly. Updated to use the
stable ProxyDevice-level accessor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 23:06:19 +02:00
Jonas Bark
9fb8d63f9a refactor: collapse to a single shared DirconEmulator for VS mode
ftmsEmulator is now the single emulator for Virtual Shifting traffic
across all trainers and the Click V2. ProxyDevice keeps a per-instance
emulator only for proxy mode (each proxy trainer advertises its own
mDNS identity). ZwiftClickV2 attaches its def to ftmsEmulator directly.

ProxyDevice exposes its own state ValueListenables (isStartedListenable,
isConnectedListenable, retrofitMode, localAddress) that mirror the active
emulator, so UI bindings survive mode swaps. setRetrofitMode and
switchRetrofitMode live on ProxyDevice and migrate the FBD between
proxy/shared emulators.

Removes companionProvider, refreshCompanions, and the click-def
internal seeding in DirconEmulator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 23:05:40 +02:00
Jonas Bark
a795b3c681 refactor: route FBD-specific callers through emulator.fitnessBike
activeDefinition now returns the CompositeBleDefinition; consumers
that need the FitnessBikeDefinition specifically use the fitnessBike
convenience getter. Bumps prop submodule to pick up the composite
machinery.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 17:55:53 +02:00
Jonas Bark
8bf449e2f4 Merge branch 'vs-improvements-asin-cw-cadence-filter' into feature/trainer-overlay-multi-window-native
VS improvements ported from Tacx-Virtual-Shifting (Berg0162):
- asin clamp + int saturation in calculateFECTrackResistanceGrade (#4a)
- cw plumbing from FTMS / Zwift envSim into VS physics calc (#7)
- opt-in CadenceFilter (median + power-aware jump limiter) (#9)
- ShiftingConfig.cadenceFilterEnabled + proxy seed
- telemetry: cadence_filter_enabled in support payload
- UI toggle in gear-ratios editor + 6-locale ARB translations

Plan: docs/superpowers/plans/2026-05-12-vs-improvements-asin-cw-cadence-filter.md
2026-05-13 09:06:39 +02:00
Jonas Bark
390d09b964 UI adjustments, add screenshot to support 2026-05-13 09:05:48 +02:00
Jonas Bark
28ec753a31 ui: add Cadence Filter toggle below Grade Smoothing
Surfaces the new opt-in cadence spike filter in the gear-ratios editor
page. Persists via ShiftingConfig.cadenceFilterEnabled; FitnessBike-
Definition picks it up on next seed.
2026-05-13 08:47:56 +02:00
Jonas Bark
2b72b64f8e overlay: re-resolve live FitnessBikeDefinition + fix macOS close + recordError
Fixes the user-reported bugs after the auto-show landed:

1. Auto-opened overlay buttons did nothing
   The trainer emulator rebinds a fresh FitnessBikeDefinition each time
   its transport restarts (e.g. when a trainer app connects), so the
   `def` captured at show() time can already be stale by the time the
   user taps + / −. Action handlers now re-resolve through a new
   `LiveDefinitionLookup` callback on every dispatch. Navigation's
   auto-show and OverlaySettingsSection's manual show both pass a
   lookup that reads `device.emulator.activeDefinition` live.

2. Toggling "Show overlay during ride" off didn't close the panel
   The vendored macOS plugin's `closeWindow` handler ignored its args
   and called `closeWindow(NSApp.mainWindow)`, which either terminated
   the app or no-op'd silently. Patched it to honor
   `isMainWindow: false` and close the (single) secondary window.

3. "Error in overlay.position.decode: Unexpected character: light"
   The vendored macOS plugin packs the Dart entrypoint args in the
   order [routeName, theme, argsJson]; the Windows runner uses
   `std::map` iteration order. The sub-window was indexing `args[1]`
   blindly. Now it scans `args[1..]` for the first JSON-looking
   payload with `x`/`y`.

Also:
- TrainerOverlayController.show now takes optional `liveDef`; all
  three implementations (desktop, android, ios) thread it through.
- Navigation initState no longer early-`return`s after auto-show, so
  the post-frame system-UI / changelog logic still runs.
- All silent `catch (_) {}` blocks in the overlay code now forward
  via `recordError(e, s, context: '...')`. New project memory
  entry [feedback_record_error.md] documents the rule.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 12:48:53 +02:00
Jonas Bark
1554ac0788 fix gear change buttons 2026-05-10 11:10:22 +02:00
Jonas Bark
1333894e3f fix(overlay): make Android overlay actually render and gate permission tile
The overlay isolate's overlayMain was annotated @pragma('vm:entry-point')
but the file was not imported anywhere, so Flutter never compiled it into
the binary. Android then logged 'Width is zero' followed by 'Destroying
the overlay window service' because the secondary engine couldn't find
the entry point. Importing it from android_overlay_controller.dart pulls
the file into the build.

Also gate the 'Grant overlay permission' settings tile on the actual
runtime permission state (FlutterOverlayWindow.isPermissionGranted),
hiding it once permission has been granted.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 10:28:17 +02:00
Jonas Bark
de871661c8 fix(overlay): UI toggle reflects controller state, not stale persisted flag
Initialize _enabled from _controller.isShowing.value in initState instead
of reading the persisted getOverlayEnabled() setting, which can be true
from a previous session while no overlay is actually showing on cold start.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 09:44:54 +02:00
Jonas Bark
ff5dfcfd15 feat(overlay): settings section (toggle, fields, tips, permission)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 09:28:54 +02:00
Jonas Bark
847a2962f5 UI, support adjustments 2026-05-05 15:27:28 +02:00
Jonas Bark
b87056c20b support imperial / metric 2026-05-05 14:15:27 +02:00
Jonas Bark
a7f0352c5f UI adjustment 2026-04-30 07:31:24 +02:00
Jonas Bark
9d5a70794b fix layout on mobile 2026-04-29 11:40:33 +02:00
Jonas Bark
e290b3e2df UI adjustments 2026-04-29 08:33:26 +02:00
Jonas Bark
6712a5803c fix reported issues 2026-04-28 10:38:04 +02:00
Jonas Bark
43cf9482bd UI fixes 2026-04-28 08:39:48 +02:00
Jonas Bark
30c4ae420b Merge branch 'claude/integrate-support-chat-qlJRP' into feat/proxy-device-details-page
# Conflicts:
#	lib/i10n/intl_de.arb
#	lib/i10n/intl_en.arb
#	lib/i10n/intl_es.arb
#	lib/i10n/intl_fr.arb
#	lib/i10n/intl_it.arb
#	lib/i10n/intl_pl.arb
#	lib/pages/proxy_device_details.dart
#	lib/pages/trainer_feedback.dart
2026-04-27 19:26:52 +02:00
Jonas Bark
39ad7b8b49 feat: add Workout Pause/Resume trainer action and inline feedback prompt
Workout: Pause/Resume action is a new InGameAction in the trainer-control
group. It toggles core.workoutRecorder between recording and paused
states without requiring a connected proxy trainer (handled in
base_actions.dart before the proxy dispatch). No-op when the recorder
is idle.

Inline feedback prompt replaces the standalone "Provide Feedback"
button on the proxy device details page. It shows "Does it work?"
with a 3-cell grid (Yes / No difference / No). Yes and No navigate
to TrainerFeedbackPage with the rating pre-filled (TrainerFeedbackPage
now accepts an optional initialRating). "No difference" dismisses
the prompt for the current page session.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 16:29:07 +02:00
Jonas Bark
51b28ca47a i18n: extract hardcoded strings on gear ratios editor and config picker
Pulls page header / reset, intro copy, virtual-shifting mode tile and
its three radio labels, gear count tile and mismatch warning, grade
smoothing tile, gear preset labels, per-gear list section labels and
neutral/current badges, neutral-relative hints, and the shifting
config picker's prompt / manage dialog copy into the ARB.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 13:23:49 +02:00