Commit Graph

171 Commits

Author SHA1 Message Date
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
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
fc83374306 refactor(incline): drive dispatch/sink-selection/UI off any incline device
- connection.dart: add inclineDevices getter (ManualInclineDevice) and
  generalize sinkProvider to pick any connected InclineSink, not just
  WahooKickrClimb; relay fallback unchanged
- base_actions.dart: dispatch incline actions to inclineDevices, not
  climbAccessories; error message now says "No incline device connected"
- button_edit.dart: gate incline card on inclineDevices, title uses
  inclineActions l10n key (generic "Incline")
- keymap.dart: hasActiveAction incline clause gates on inclineDevices
- incline_controller.dart: reset _lastWritten on manual hold so returning
  to auto re-asserts the grade even when grade equals last auto-written value
- incline_controller_test.dart: add re-asserts-after-manual-hold test

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 23:40:41 +02:00
Jonas Bark
1b10dee7f1 refactor(incline): generic incline in-game actions + labels
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 23:34:57 +02:00
Jonas Bark
8d99bf418b feat(climb): register KICKR Climb, generalize accessory exclusion, dispatch actions
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 21:28:50 +02:00
Jonas Bark
b1fff33480 feat(phone-steering): dispatch calibratePhoneSteering action to recalibrate device
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 10:48:13 +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
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
42c246799d Merge feat/screen-recording into 6.2: screen recording action (Android + macOS) + changelog 2026-06-24 20:21:47 +02:00
Jonas Bark
2eb7e56219 feat(6.2): move Record Screen under Weitere Aktionen (below screenshot) + open-folder action on saved recording 2026-06-24 18:48:22 +02:00
Jonas Bark
43052a2180 feat(6.2): handle screenRecording action in base_actions 2026-06-24 16:36:10 +02:00
Jonas Bark
81f5a433a6 feat: both-shifters combo (coincidence window) + BaseActions helpers
Add frontShiftComboEnabled getter, performInGameAction synthetic dispatch,
and a coincidence-window detector to BaseActions for two-device controllers
(e.g. Zwift Play) whose shifts arrive as separate performAction calls. When
the opposite rear shift lands within 120 ms, additively emit a frontShift
(the two rear shifts cancel; the front ring toggles). Reuses the existing
trainer-action/direct-connect routing rather than extracting a dispatcher.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 16:34:41 +02:00
Jonas Bark
a6f409f9ea misc fixes 2026-06-18 17:48:25 +02:00
Jonas Bark
843f798537 cleanup 2026-06-18 16:30:01 +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
c957817fb5 fix logic 2026-06-09 22:13:17 +02:00
Jonas Bark
3de50a0907 fix button mapping popup 2026-06-01 12:01:31 +02:00
Jonas Bark
a68b68a1b4 fix button mapping popup 2026-06-01 11:53:55 +02:00
Jonas Bark
860a1b3523 fix trainer connection logic 2026-05-06 06:27:21 +02:00
Jonas Bark
6712a5803c fix reported issues 2026-04-28 10:38:04 +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
2071719fbd UI adjustments 2026-04-26 09:44:56 +02:00
Jonas Bark
1b13bdab0a direct control refactoring 2026-04-25 13:45:14 +02:00
Jonas Bark
135494819d ui adjustments, DRY fixes 2026-04-24 14:13:05 +02:00
Jonas Bark
b6996c937b feat(trainer-actions): consolidate shift/erg into mode-aware up/down + switchMode 2026-04-23 10:18:40 +02:00
Jonas Bark
fa6a26686a Android: broadcast a custom Intent on button press - connect your controller to automation apps like MacroDroid or Tasker to turn your phone into a ringbell, trigger Shortcuts, toggle lights, and more (Pro) 2026-04-22 10:48:42 +02:00
Jonas Bark
b5500ba5af feat(actions): dispatch trainer-control actions to ProxyDevice
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 10:39:39 +02:00
Jonas Bark
8d2c6978c9 Merge remote-tracking branch 'origin/main' into proxy 2026-03-24 13:04:29 +01:00
jonasbark
6c5f80b4b6 Merge pull request #321 from Tumlinh/headwind-inc-dec
RFC WIP: Add two actions to Wahoo KICKR headwind to increase and decrease speed respectively
2026-03-23 20:53:04 +01:00
Jonas Bark
f04fe5a2c3 fix action handling with multiple active connections 2026-03-23 12:04:08 +01:00
Jonas Bark
d62c86fa77 fix access logic 2026-03-22 09:48:38 +01:00
Jonas Bark
6cd355c9f9 allow music / volume control for old purchases 2026-03-20 16:48:23 +01:00
Tumlinh
1a011dd9de Add two extra Wahoo KICKR headwind actions for cyclic speed increase/decrease 2026-03-14 12:14:35 +00:00
Tumlinh
b7f337b111 Add two actions to Wahoo KICKR headwind to increase and decrease speed respectively 2026-03-14 11:43:40 +00:00
Jonas Bark
7986437c6d add log entries 2026-03-11 10:30:43 +01:00
Jonas Bark
2c27f398e0 new ui #9 2026-03-11 08:15:02 +01:00
Jonas Bark
91f693ec0d new ui #5 2026-03-10 21:02:41 +01:00
Jonas Bark
922c785df1 new ui #4 2026-03-10 19:04:51 +01:00
Jonas Bark
60c4df253d create screenshot on Windows + macOS 2026-02-25 20:57:12 +01:00
Jonas Bark
33c6346865 fallback when multiple triggers are defined 2026-02-25 19:13:51 +01:00
Jonas Bark
fba1b82b07 add long press option for devices that do not support it (tap once = down, tap again = up) 2026-02-25 18:43:00 +01:00
Jonas Bark
f4b9a349d0 individual actions for single, double, long press 2026-02-25 11:20:18 +01:00
Jonas Bark
5c057f9bd4 enable shortcuts on iOS as well 2026-02-24 10:56:23 +01:00
Jonas Bark
1c96ddff60 resolve issue #310 2026-02-23 18:48:50 +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
940508eb6f Windows: run any command 2026-02-23 09:07:45 +01:00
Jonas Bark
34fade442e shortcuts only available on macOS 2026-02-22 18:43:12 +01:00
Jonas Bark
403ee4e9f9 macOS: open specific shortcut 2026-02-22 18:40:58 +01:00