Commit Graph

108 Commits

Author SHA1 Message Date
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
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
194a90ae4a feat(onboarding): trigger wizard on fresh installs, add Setup guide menu entry
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-09 22:16:22 +02:00
Jonas Bark
4c0184bcd6 feat(click-v2): add onboarding-completion setting 2026-08-03 09:04:49 +02:00
Jonas Bark
08d31ede0c feat: auto-arm WHEELTOP keepalive probe; quiet quick-drop loop when off
The probe was only reachable via a device-page toggle, but TX pods drop
so fast the user can never open the page — the one field tester couldn't
enable it. Arm the probe automatically on the first 0x10 status frame
(the moment that proves a pod needs the reply), default on; the toggle
becomes an opt-out. Move probe creation out of handleServices into a
lazy arm on that frame.

When the experiment is off, count a connect that dies within
quickDropThreshold (5s) as a failure via the same backoff, so the
endless connect/connected/disconnected loop gives up after 3 and shows
the guidance instead of spamming forever. While the experiment is on the
device opts out (keepsReconnectingWhileDropping) so the loop keeps
cycling for the probe. Extract _engageBackoff shared by both paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 13:25:54 +02:00
Jonas Bark
4a7a301043 feat: WHEELTOP keepalive-reply prober (opt-in beta experiment)
TX pods drop the link after three unanswered 1 Hz status frames; the
derailleur's reply is unknown and undocumented anywhere public. When the
user opts in (device page > Preferences), each reconnect cycle writes
the next reply candidate (type-echo, ack, 3-byte XOR shapes, bare ACK —
on 6e400003 first, then other writable NUS slots) once after subscribe
and again per status frame, and logs the connection lifetime per
candidate. A lifetime past 5 s marks the likely answer; unexpected
frames are logged loudly as potential pod responses. Worst case per
attempt is the disconnect that already happens.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 09:38:50 +02:00
Jonas Bark
bdfbe4395c fix(sram): differentiate left/right shifters and default one lever to shift down
Testers reported both AXS shifters doing the same thing and gears only ever
increasing, with presses logged as a generic "SRAM Paddle". Root cause: both
drop-bar paddles report button mask 1, so the mask alone can't tell them apart,
and every discovered button was hardcoded to InGameAction.shiftUp.

- Use the button event's controller device_type (prop SramPress.deviceType,
  field 2) to name and key buttons, so left and right become distinct keymap
  entries even in a plaintext (serial-less) session — the common case in the
  field. Names now resolve to "SRAM Left/Right Shifter" without needing an
  advert or the sparse d9050003 serial.
- Default the LEFT paddle to shift DOWN and everything else to shift UP so the
  shifters aren't identical out of the box ("one lever changes down") without
  hunting through the keymap. Every button stays freely remappable.
- Persist the device_type in the button record so a restart re-registers the
  same left/right name + default instead of a duplicate entry; two serial-less
  paddles that differ only by side stay separate, and a legacy side-less record
  upgrades in place once the side is known.
- Remember a shifter's side against its serial (preserving any known model) when
  both are seen, so its other buttons resolve the same name.
- Bump the prop submodule to the field-2 decode.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H48NvkfXYm2spiiwcTQsv8
2026-07-09 09:12:41 +02:00
Jonas Bark
df1cebd326 fix(sram): exclude non-button components from pre-registration; stabilize names
sramShifterAdverts now gates on effectiveType (no model escape hatch), so a
front derailleur or dropper post no longer mints a phantom paddle button.
Persist each shifter's advertised type/model by serial so a button's §6.4 name
survives sessions where the shifter isn't advertising, instead of orphaning the
keymap mapping.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 17:34:52 +02:00
Jonas Bark
8204a41a8b fix(sram): never overwrite the saved backup on re-run; re-bond stale keys
setupControl captures the original config only once and never overwrites a
saved backup (a re-run reads the already-cleared device and would wipe it);
restore clears the backup so a later setup re-captures. Both flows verify the
session key via ensureBonded and persist any re-bond.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 15:09:13 +02:00
Jonas Bark
200ee36e1b refactor(sram): use BikeControl's built-in double-click, drop custom gesture layer
Each physical (shifter, button) now emits one press so the base device
handles single/double click from the keymap, like every other controller.
Removes the SRAM-specific tap-count timer and the double-click-window setting/UI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 14:47:13 +02:00
Jonas Bark
da2c0f6001 feat(sram): persist session key, config backup, disabled flag, buttons
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 13:33:32 +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
6778c1e45b feat: optimize Zwift Click V2 left/right experience
- Make the split left/right controllers available to everyone: replace the
  isPro gate in the device factory with a "Use new unlock method" setting
  (default on); off falls back to the legacy unified ZwiftClickV2.
- Add the "Use new unlock method" toggle to all three Click V2 settings panels;
  flipping it reconnects the Click as the new/legacy representation.
- Fix the "Unlock again" button placement: on narrow side-by-side cards the
  action now drops below the status text instead of squeezing it.
- Add "Use the right side only" to the right side when a left side is connected:
  ignores the left side (reversible via Ignored Devices) and remaps the active
  keymap so + shifts up and B shifts down.
- Localize new strings (de/es/fr/it/pl; en already present) and add
  factory/settings unit tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-17 19:50:08 +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
8f221245cc new unlock method 2026-06-06 19:54:00 +02:00
Jonas Bark
bd7cb80014 feat: reload emulator advertisement when trainer app changes
- Settings.trainerAppListenable fires from setTrainerApp.
- Connection.initialize listens and restarts ftmsEmulator + each
  ProxyDevice's _proxyEmulator so the new advertisement name (e.g.
  "Zwift Hub" for Rouvy) appears on the wire without reconnect.
- ProxyDevice.restartProxyEmulator no-ops in VS mode (ftmsEmulator
  handles itself).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-31 18:33:33 +02:00
Jonas Bark
75dd10371a show default OBP actions 2026-05-11 20:53:25 +02:00
Jonas Bark
6d83c78892 some fixes 2026-05-09 10:26:52 +02:00
Jonas Bark
7a88d2d200 fix(overlay): use Set<OverlayField> typing in Settings accessors
The prop package re-exports protocol/zp.pb.dart which defines a protobuf
`class Set`, shadowing the built-in Set type. Added `hide Set` to the
prop import so Dart's Set is visible and the overlay accessors can use
proper Set<OverlayField> types instead of dynamic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 22:57:14 +02:00
Jonas Bark
661b63107a feat(overlay): persist overlay enabled, fields, and desktop position 2026-05-08 22:55:13 +02:00
Jonas Bark
4cf347580d warn when connecting smart trainer 2026-05-07 15:57:02 +02:00
Jonas Bark
847a2962f5 UI, support adjustments 2026-05-05 15:27:28 +02:00
Jonas Bark
bfc21510ad feat: persist Di2 BLE enabled flag in settings 2026-04-28 19:03:46 +02:00
Jonas Bark
e999795655 feat: surface unread support-chat replies on the HelpButton
Adds a sticky 'support_chat_active' bool to Settings, flipped to true
the first time SupportChatService.openChat succeeds. HelpButton becomes
a StatefulWidget; if the flag is set in initState it kicks off a
background fetchChat() and counts admin-side messages whose createdAt
is later than the chat's lastSeenAt. When at least one is found, a
small destructive-coloured dot appears both on the button's leading
icon (top-right corner) and as the trailing slot of the inline 'Chat
with Support' menu entry.

Opening the chat clears the dot locally and re-runs the unread check
on return so the indicator stays in sync with what the user has now
seen. All checks are best-effort: missing auth, network errors, and
edge-function failures are swallowed and the dot just stays off.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 08:44:01 +02:00
Jonas Bark
c6ddfc7a3e fix 2026-04-26 13:02:06 +02:00
Jonas Bark
0dc041737a feat: wire ReviewPromptService into app startup
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 12:09:56 +02:00
Jonas Bark
596c89bbb5 feat: add settings keys for in-app review prompt tracking
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 12:06:16 +02:00
Jonas Bark
9f3e418649 feat: default smart trainers to Virtual Shifting on first connect
Adds ProxyDevice.defaultRetrofitMode that returns RetrofitMode.bluetooth or
RetrofitMode.wifi when the device advertises FTMS and the user has a
matching Trainer Connection enabled (resolved via preferredBridgeTransport).
Power-meter-only and HRM-only devices, plus smart trainers with no enabled
Bridge transport, fall back to RetrofitMode.proxy.

Threads the device default through Settings.getRetrofitMode as a `fallback`
parameter so the auto-connect path, the tap-to-connect handler in
ProxyPage, and the picker's initState all surface VS first.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 22:40:36 +02:00
Jonas Bark
ddfc44ce24 feat(proxy): remember intent to connect; auto-start on next scan
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).
2026-04-21 10:55:33 +02:00
Jonas Bark
1e79c31ff8 feat(settings): per-trainer retrofit-mode persistence 2026-04-21 09:32:39 +02:00
Jonas Bark
f75fc6dd69 feat(settings): re-apply trainer settings on connected proxies when keymap changes 2026-04-20 09:43:38 +02:00
Jonas Bark
22d603aac0 refactor(settings): drop legacy proxy_* accessors
All call sites now go through core.shiftingConfigs and the active
ShiftingConfig. Remove the global getProxy*/setProxy*/clear helpers
and the associated clamp constants; these lived at lib/utils/settings/settings.dart:488-568.
The unused fitness_bike_definition import it pulled in drops with
them.
2026-04-20 07:46:27 +02:00
Jonas Bark
650b4737c4 feat(settings): persist custom 24-step gear ratios
Adds getProxyGearRatios/setProxyGearRatios/clearProxyGearRatios on
the Settings class, bumps the prop submodule to pick up the mutable
table and public gear constants on FitnessBikeDefinition, and covers
the roundtrip + edge cases with tests.
2026-04-15 23:02:19 +02:00
Jonas Bark
f14c9ff01e feat(settings): add proxy bike/rider weight, grade smoothing, VS mode 2026-04-15 21:02:38 +02:00
Jonas Bark
8ede62aed1 cleanup 2026-04-15 11:14:21 +02:00
Jonas Bark
e955d81fce connection settings adjustments 2026-03-18 10:07:22 +01:00
Jonas Bark
91f693ec0d new ui #5 2026-03-10 21:02:41 +01:00
Jonas Bark
809596d397 revise logic 2026-03-06 18:18:23 +01:00
Jonas Bark
92e80647d2 login with facebook, UI fixes 2026-03-06 14:40:30 +01:00
Jonas Bark
7c0d2cd25c UI adjustments 2026-02-27 12:33:18 +01:00
Jonas Bark
ba0af42129 user settings fix 2026-02-23 22:13:47 +01:00
Jonas Bark
98e7eaf51a work on issue #310 2026-02-23 15:18:17 +01:00
Jonas Bark
184cc5d671 Merge remote-tracking branch 'origin/copilot/allow-key-presses-to-rouvy' into login 2026-02-23 14:27:05 +01:00
copilot-swe-agent[bot]
1a19d740e7 Add target app name setting to send key presses to a specific app on macOS
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-23 08:26:10 +00:00
Jonas Bark
9dfc4fd608 user settings sync implementation 2026-02-22 10:12:52 +01:00
Jonas Bark
3abbae24d7 user settings sync implementation 2026-02-22 09:17:45 +01:00
Jonas Bark
a9f52dbbd0 sign in with google, apple 2026-02-16 16:26:22 +01:00
Jonas Bark
6686278457 add new remote keyboard connection method 2026-02-05 17:22:21 +01:00
copilot-swe-agent[bot]
3b69fdd510 Implement media key detection persistence
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-04 14:07:07 +00:00
Jonas Bark
b7536a9c1b update translations 2026-01-28 09:59:18 +01:00