Move the persisted-flag check from Connection._handleConnectionQueue
into ProxyDevice.connect() itself. connect() was an intentionally-empty
override (so the upstream BLE connect doesn't fire automatically); it's
the natural place to honour "user already said yes, keep reconnecting"
since _connect() in the connection queue awaits it anyway.
Net effect is identical to before, but the ProxyDevice class now
encapsulates its own reconnection policy instead of the connection
manager having to special-case it.
Persist a per-trainer auto_connect_<trainerKey> flag via Settings. Set
to true whenever the user explicitly starts the emulator (tap in the
Trainer & Accessories list, or the Connect button on the disconnected
card). Clear to false when they tap Disconnect (or Disconnect & forget).
In Connection._handleConnectionQueue's proxy branch, after the shared
listener setup finishes, check the flag for the scanned ProxyDevice —
if set and nothing else is in flight, pick up the saved retrofit mode
and fire startProxy() so the emulator is ready by the time the user
opens the details page (or without opening it at all).
Capture `_useAccordion` in initState based on the starting retrofit
mode: Proxy stays expanded (diagnostic-friendly default), anything
else mounts collapsed. Live switches no longer flip the picker's form
mid-interaction — if it started expanded it stays expanded for the
life of the page, and vice versa. The user only gets the accordion
layout on the next time they open ProxyDeviceDetailsPage.
Proxy is the default / diagnostic-friendly mode where the picker should
stay one tap away. Virtual Shifting (WiFi or Bluetooth) is the "normal"
riding state and takes up valuable vertical space above the more
important Gear Hero / metrics / settings below. Wrap the live picker in
a collapsed Accordion whose trigger reads "Connect mode: {mode label}"
with the mode icon, so the user still sees what's active at a glance
and can expand to change it.
Register the emulator's onFitnessBikeDefinitionCreated hook in the
ProxyDevice constructor so every freshly-instantiated definition —
whether on first connect or mid-session mode swap — is seeded from
the active ShiftingConfig before the transporter starts or any
notifier fires. Eliminates the default-value flash that appeared
between retrofitMode flipping and the post-await seeding call.
applyTrainerSettings now delegates to the same _seedFitnessBikeDefinition
helper used by the hook, so the two paths can't drift apart.
Drop the redundant applyTrainerSettings() call in ConnectionCard's
mode-picker onChanged — the hook already handles it synchronously.
switchRetrofitMode disposes the old FitnessBikeDefinition and creates
a fresh one with stock defaults (bike=5kg, rider=75kg, maxGear=24,
gradeSmoothing=true, mode=targetPower). Without re-applying the user's
active ShiftingConfig, the new def boots with those defaults regardless
of what was configured. Call device.applyTrainerSettings() right after
the await so the new def is seeded before the notifiers settle.
The details page's _gearSection and _settingsSection gate on
`def is FitnessBikeDefinition`, which flips to false in Proxy mode
(activeDefinition becomes ProxyBikeDefinition). Without a listener on
emulator.retrofitMode, switching to Proxy left the VS cards stale on
screen. Hook the notifier into _onEmulatorStateChanged so setState
fires on every mode swap.
ConnectionCard's connected-state view is now just the mode picker —
the large coloured "Proxy/WiFi/Bluetooth active" banner (and the bridge
row with device-name / IP) is removed. Dead _bridgeRow and _dot helpers
dropped.
ShiftingConfigPicker no longer sits between the connection card and the
gear section; it's now the first entry inside TrainerSettingsSection,
grouping config-scoped controls (picker, VS mode, gear settings, bike
weight, rider weight).
ProxyPage no longer awaits startProxy — the details page opens the
moment the user taps a device and the BLE connect runs in the
background. ProxyDevice exposes an isStarting ValueNotifier that flips
true across super.connect(), so ConnectionCard can render a
"Connecting in {mode} mode…" row (with a small progress indicator)
between the tap and the first successful start.
Also restore the per-mode hint subtitles on the live picker — they
were load-bearing ("Mirrors your trainer over WiFi…" etc.) and I'd
trimmed them to fit a compact row. Layout now matches the disconnected
picker (vertical list, icon + label + subtitle, CONNECT MODE header).
The disconnected picker now persists the chosen mode on selection and on
the Connect button. When the emulator is running, a compact picker row
sits above the status banner; changing it persists the choice and calls
emulator.switchRetrofitMode so the upstream BLE link stays connected
while the transport swaps.