Commit Graph

25 Commits

Author SHA1 Message Date
Jonas Bark
56a8e87f7d i18n(home): translate the setup chain, align its checklist, stop billing
undelivered shifts

Three things.

The chain's 68 strings existed only in English, so five locales fell back
to it on the app's main screen. Now translated, in each file's own register
— informal second person throughout, matching the copy already around
them. Polish needed a `few` plural category for the step and day counters:
it uses a distinct form for 2-4, so `other` would have rendered "Zostały 2
kroków" instead of "kroki". Two keys written speculatively and never wired
up are dropped rather than sent to five translators.

The checklist's summary row sat inside a Button whose own padding inset it
past the steps below, and the leading glyphs differed in both width (15px
icon, 17px tick) and gap, so matching the outer inset alone would not have
lined them up. One _rowInset / _leadingSize / _leadingGap now governs both,
with the glyphs centred in a box of equal width. Two tests pin the tick and
the label columns, because this is exactly what drifts back unnoticed.

Finally, shifting with a trainer connected but no app holding the bridge
was charged to the daily command budget. Those shifts reach nothing. The
existing exemption only covered the case where the 20-minute
virtual-shifting budget was already ticking — that avoids double-billing —
so it grows a second reason: a command that was never delivered anywhere is
not a command the rider spent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 14:39:07 +02:00
Jonas Bark
e310adbceb Merge branch '6.2' into 6.3
Brings SRAM AXS shifter support, beta-access/Shorebird track, and the
battery-saver timeout fix into 6.3. Merged the prop submodule (83f4bf9) so the
SRAM parser/button-tables and the Climb protocol coexist. Resolved: CHANGELOG
(SRAM AXS folded into 6.3.0), the prop pointer, and repointed the SRAM
integration test to the fake-BLE harness that 6.3 promoted into lib/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 12:04:00 +02:00
Jonas Bark
2f5373cc60 feat: add beta_access entitlement flag and Shorebird track mapping
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:02:23 +02:00
Jonas Bark
c648705949 feat(core): showLocalKeyboardCard/showLocalTouchCard visibility getters
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRVXtrmcgtKKz46AVDyqQp
2026-07-02 08:51:00 +02:00
Jonas Bark
50d9eea27d feat(iap): exempt internal trainer commands from daily limit during free testing
When the active FitnessBikeDefinition handles a trainer action internally
(gear shift, front shift, mode switch, intensity), don't count it against
the daily command limit for a free tester whose bridge session is still
counting down — no Pro on this device, no full version, and the 20-minute
budget not yet exhausted. All other counting paths are unchanged.

The increment now runs after handleTrainerAction so the decision can key
off whether the FBD actually handled the action. Gating lives in the pure,
testable BaseActions.isExemptInternalTrainerAction and is applied in both
the performAction trainer branch and the both-shifters combo path. Bumps
the prop submodule to its 6.3 branch for the new isCountingDown getter.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRVXtrmcgtKKz46AVDyqQp
2026-06-30 10:17:02 +02:00
Jonas Bark
786621a11b Localize TrainerConnection titles (re-evaluate per locale)
The connection titles ("Connect using Bluetooth", "Connect directly over
Network", "Connect using MyWhoosh Link", ...) were captured once at object
construction in English, so they didn't follow the active locale. Back the
title with a builder (String Function()) and expose it via a getter so it
re-localizes — fixing the English titles in the localized store screenshots.
Updated all 10 subclasses and the fake connection in the bridge-transport test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 11:47:43 +02:00
Jonas Bark
5d06ffa65f feat(iap): add freeAgainFromBuild gate (isPurchasedBuild helper) + tests 2026-06-17 20:20:10 +02:00
Jonas Bark
b5c25c5b21 Clearer log message when a trainer-app action can't be delivered (issue #367)
Pressing a virtual-shifting button after the trainer app (Zwift) had
disconnected logged the misleading "Could not perform <key>: No action
assigned" — but an action *is* assigned; the trainer app just isn't
connected to receive it.

Root cause: a pure in-game action (gear shift) has no keyboard/touch
fallback, so when no trainer app accepts it the press fell through to the
platform keyboard path, which reports "no action assigned". This only
surfaced with local control enabled, because `local` counts as a
"connected" trainer connection yet its sendAction always returns
NotHandled — so isTrainerConnected() was true and the generic
"no connection method active" guard was bypassed.

Fix: detect delivery failure after _handleDirectConnect. When a
trainer-app-only keypair (KeyPair.isTrainerAppActionOnly — an in-game
action with no keyboard/touch/command/screenshot fallback, excluding
headwind/trainer-control which target a proxy/accessory) goes unhandled,
report "Could not perform <key>: <app> is not connected" instead. Such
keypairs also now skip the generic isTrainerConnected early-return so the
specific message wins consistently. Keypairs with a keyboard fallback are
untouched and still fall through to the keyboard.

Tests: KeyPair.isTrainerAppActionOnly discrimination (keyboard/touch/
command fallback and outside-trainer-app actions excluded) and an
end-to-end regression covering the exact #367 trigger (local control on).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 09:46:38 +02:00
Jonas Bark
e9e7425c29 Integration tests: controller connections + virtual shifting through fake platform seams
Add test/integration with platform fakes installed at the plugin seams
(UniversalBle.setInstance, NsdPlatformInterface.instance); everything
above them — Connection, device classification, protocol parsers, press
state machine, keymaps, ProxyDevice — is the real code:

- controller_connection_test: scan→classification (Zwift Click/Ride via
  manufacturer data, Di2 via service UUID, FTMS trainer→ProxyDevice,
  ignored names/devices), connect lifecycle (device-info reads, battery,
  RideOn handshake, subscriptions), drops, dedupe, forget list.
- controller_button_chain_test: byte-accurate BLE notifications through
  the full reaction chain — single/double/long press, trigger remapping,
  duplicate-frame dedupe, unmapped-button error surfacing, multi-button
  Ride presses.
- virtual_shifting_connection_logic_test: retrofit-mode defaults (WiFi /
  BT-wins / proxy for power meters), auto-connect consent gating,
  in-place "No connection" disconnect + in-place reconnect, WiFi trainer
  discovery rules (found/lost/connected-survives-flap, self-exclusion),
  and an end-to-end Click-press → real action pipeline → gear shift.

Protocol-level coverage (DirCon over real TCP, BLE peripheral) lives in
the prop submodule's own tests — no prop internals in this repo.

Bug fix found by these tests: Connection.disconnect(keepInList: true)
was defeated — UniversalBle.disconnect resolves only after the platform
disconnect event, so the still-attached connectionStream listener
re-entered disconnect() without keepInList and dropped the device,
orphaning the object the open details page holds (the exact bug
0db8cf0c addressed). Guarded via _inPlaceDisconnects.

Also update stale tests to current behavior: sim-mode shifts return
Ignored since e0e4494d (handled by the bridge, not forwarded, logged
neutrally), ControllerButton.initials direction arrows, and skip the
third BC2 state-machine test consistently with its siblings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 18:59:14 +02:00
Jonas Bark
a68b68a1b4 fix button mapping popup 2026-06-01 11:53:55 +02:00
Jonas Bark
661b63107a feat(overlay): persist overlay enabled, fields, and desktop position 2026-05-08 22:55:13 +02:00
Jonas Bark
b87056c20b support imperial / metric 2026-05-05 14:15:27 +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
642fc754a1 UI adjustments, BLE advertisement fix 2026-04-26 09:14:00 +02:00
Jonas Bark
60036fe92f test: drop unused buttons import from preferredBridgeTransport test
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 21:44:15 +02:00
Jonas Bark
5bc7ae5531 test: drop unused foundation import from preferredBridgeTransport test 2026-04-25 20:36:46 +02:00
Jonas Bark
c5c5d85b67 feat: add CoreLogic.preferredBridgeTransport resolver
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 20:31:57 +02:00
Jonas Bark
b7d9fba548 compatibility changes 2026-04-25 19:23:34 +02:00
Jonas Bark
238fdf0df3 feat(controller): add ControllerButton.initials getter 2026-04-24 10:33:38 +02:00
Jonas Bark
03e1727d6a feat(supported-app): add per-app trainer connection types 2026-04-23 08:52:09 +02:00
Jonas Bark
1e79c31ff8 feat(settings): per-trainer retrofit-mode persistence 2026-04-21 09:32:39 +02:00
Jonas Bark
df937d7fec feat(keymap): add virtualGearAmount on SupportedApp (MyWhoosh=30, default=24) 2026-04-20 09:14:06 +02:00
Jonas Bark
365c29ac52 test(shifting): remove obsolete settings_proxy_test.dart
The file exercised getProxy*/setProxy*/clearProxyGearRatios accessors
deleted alongside the ShiftingConfig migration. Equivalent coverage
now lives in test/models/shifting_config_test.dart (defaults,
clamping, 24-entry gear-ratios guard) and
test/services/shifting_configs_controller_test.dart (persistence
round-trip, active invariant).
2026-04-20 08:06:40 +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