Commit Graph

136 Commits

Author SHA1 Message Date
Jonas Bark
c4c48dff07 Merge remote-tracking branch 'origin/6.5' into 6.5 2026-08-21 08:03:17 +02:00
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
351bb4ca63 fix(attribution): guard install-referrer report on settings init + document reporter ctor
Add core.settings.isInitialized to the Android install-referrer gate in
main.dart. Settings._prefs is a late SharedPreferences assigned during
Settings.init(); if SharedPreferences.getInstance() throws, _prefs is
never assigned. The referrer block previously read core.settings.prefs
unconditionally, so that failure would raise a LateInitializationError
from inside the guarded zone before runApp(BikeControlApp(error: error))
ran, skipping the intended error screen. Gating on isInitialized (already
used the same way in click_v2_onboarding.dart) skips the block instead.

Also add a one-line doc comment to the InstallReferrerReporter
constructor describing its injected source/prefs/send collaborators, to
match the class-level doc comment already present.

No logic changes in install_referrer_parser.dart.
2026-08-17 08:06:35 +02:00
Jonas Bark
d91cd2b942 feat(attribution): report the install referrer on Android startup
Fire-and-forget after settings init so it cannot delay launch, and guarded to
Android since no other store passes a referrer through.

Failures route through recordError rather than being dropped -- a silently
broken attribution path is worse than a noisy one, because it looks identical
to having no installs.
2026-08-17 08:00:51 +02:00
Jonas Bark
a1916387a0 feat(onboarding): design fade-up entrance per step, onboarding-scoped mobile toast lift
Every step body slides in with the design's bk-fade-up (300ms fade +
12px rise), re-keyed per step and controller phase; static under reduced
motion and screenshotMode so snapshots stay deterministic. Mobile toasts
return to normal bottom placement and are lifted (72px, bottom-center)
only while the wizard is on screen, tracked via an onboardingActive flag
next to screenshotMode.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 10:30:40 +02:00
Jonas Bark
18c282c698 demo mode 2026-07-10 13:01:38 +02:00
Jonas Bark
c95eb147c3 feat(emulation): EmulationManager, profiles model, Click/Ride profiles, debug platform install
Adds the EmulationProfile/EmulatedInput model, EmulationManager +
EmulationSession, removePeripheral on the fake BLE platform, the first two
device profiles (Zwift Click + Ride) with an allEmulationProfiles registry,
core.emulation, and the debug-only RoutingBlePlatform install in main().
2026-07-02 09:45:12 +02:00
Jonas Bark
bca8fee0be Bump prop submodule: drop unhostable Cycling Power on Windows BLE; relabel handled errors
- prop 9ec8e83: BluetoothTransporter no longer registers/advertises the Cycling
  Power service (0x1818) on Windows when FTMS is present, fixing the handled
  'Service not found for advertising' PlatformException seen in support logs.
- main.dart: _persistCrash now labels caught errors 'Handled error <type>:' and
  reserves 'App crashed <type>:' for genuinely-uncaught contexts
  (isFatalErrorContext: Zone/PlatformDispatcher/Isolate), so handled errors stop
  reading as crashes in the diagnostics log.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 21:55:06 +02:00
Jonas Bark
cfe9e1d6b7 fix: guard crash-logger debugText call; migrate widget test to new permissions API 2026-06-22 12:15:06 +02:00
Jonas Bark
788bdc5436 feat: embed diagnostics block in debugText; skip discovery on crash path 2026-06-22 10:32:40 +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
96b308d6c9 Wire Logger.onRecordError to recordError/persistCrash
installLoggerErrorListener() (installed at the top of main and lazily by
recordError) forwards every Logger.recordError — app- and prop-side —
into the existing pipeline: debug print + _persistCrash, which appends
to app.log and feeds Connection.lastLogEntries, i.e. the "Logs:" section
of the support-chat debug text. recordError itself is now a thin
delegate into Logger.recordError.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 13:34:53 +02:00
Jonas Bark
d40c05d64d Enable the custom mDNS responder on Android (multicast lock via prop)
prop's MulticastMdnsSocket now holds a WifiManager multicast lock on
Android, so platformDefault() selects the A-only responder there too;
flutter_multicast_lock enters the lockfile as a transitive dependency
and its plugin manifest contributes CHANGE_WIFI_MULTICAST_STATE. Only
iOS remains on the OS responder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 10:18:46 +02:00
Jonas Bark
44ed08070f Use the custom mDNS responder on desktop (TrainingPeaks IPv6 fix)
Switch the OBC/DirCon advertisement to prop's ServiceAdvertiser seam and
select the in-process responder backend on macOS/Windows/Linux at app
startup. The advertisement now carries a dedicated hostname with a
single A record, so Mono-based trainer apps (TrainingPeaks) no longer
pick a scope-less IPv6 link-local and fail with 'No route to host'.
iOS/Android keep the OS responder via nsd.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 20:46:19 +02:00
Jonas Bark
e4ad6135eb overlay: auto-show on startup when trainer connects + remove debug logs
Auto-show:
- Navigation initState now subscribes to core.connection.connectionStream
  when the persisted overlay_enabled flag is true. The first connected
  smart trainer with a FitnessBikeDefinition triggers
  TrainerOverlayService.show(...) with the persisted overlay fields.
- Subscription is one-shot (cancels itself after a successful show) and
  also checks already-connected devices on mount, so the overlay reopens
  whether the trainer was reconnected before or after Navigation mounted.

Debug-log cleanup:
- Removed the `bikecontrol_dart_alive.log` liveness probe, the
  `[main:entry]` / `[main:entry/stderr]` print + stderr.writeln, the
  `[overlay-main]` step-by-step logs in the sub-window dispatch, the
  `[main:wm-spy]` channel-handler wrapper, the `[overlay-run]` /
  `[overlay-sub]` action logs in desktop_overlay_window, the
  `[overlay-main]` action-receive / dispatch-fail logs in
  desktop_overlay_controller, the `[main]` Android handler-retry logs,
  and the noisy `[multi_window_native] CreateNewWindow` cerr in the
  Windows runner.
- Kept catch handlers as silent (or kDebugMode-guarded) where the
  original error path was still useful.

Also: MainFlutterWindow simplified back to NSWindow — the vendored
multi_window_native plugin now creates the overlay sub-window as an
NSPanel with .screenSaver level + .fullScreenAuxiliary itself, so
the main window no longer needs the canBecomeMain/canBecomeKey
NSPanel overrides or the .normal level pin.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 12:35:31 +02:00
Jonas Bark
ded579fba9 overlay/desktop: spy on multi_window_native channel on main isolate
Confirmed flow: [overlay-sub] + tap fires, but [overlay-main] action
received never does. The sub-window calls BroadcastToAll which iterates
registered messengers and invokes the method on each. The main
messenger IS registered (SetMainWindowMethodHandler does that), so we
expect the call to land on main's Dart-side handleMethodCall.

Add a spy that wraps multi_window_native's Dart-side handler on the
main isolate's channel:

  channel.setMethodCallHandler((call) async {
    debugPrint('[main:wm-spy] received ${call.method}: ...');
    return MethodChannelMultiWindowNative.handleMethodCall(call);
  });

If [main:wm-spy] never fires for the action methods, the broadcast
never reaches main Dart at all — and the bug is in BroadcastToAll's
messenger iteration on the C++ side. If [main:wm-spy] fires but the
delegated handleMethodCall doesn't dispatch to our registered listener,
the bug is in the package's listener bookkeeping (per-isolate static
state, etc.).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 11:33:49 +02:00
Jonas Bark
a416f59411 overlay/desktop: fix zone mismatch, transparent macOS bg, action diagnostics
Three issues:

1. Zone mismatch from runApp:104. The diagnostic
   `WidgetsFlutterBinding.ensureInitialized()` + ping MethodChannel call
   ran BEFORE `runZonedGuarded` and bound the binding to the root zone;
   `runApp` then fired inside the zone -> mismatch. Removed the outer
   diagnostic — Dart liveness is no longer the unknown here, and the
   file-write probe at the top of main() still confirms it if needed.

2. Black window background looks bad on macOS. Win32 can't do real
   transparency without WS_EX_LAYERED, so it needs the dark fill, but
   macOS handles NSWindow alpha properly via window_manager. Make the
   Scaffold backgroundColor platform-conditional:
   - Windows: opaque 0xFF111114
   - everything else: transparent

3. Button events from the overlay don't arrive in the main app. Adding
   debugPrint at both ends ([overlay-sub] −/+ tap and [overlay-main]
   action received) to see where the BroadcastToAll → Dart listener
   chain breaks. Behaviour unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 11:27:17 +02:00
Jonas Bark
960a12d077 overlay/desktop: use multi_window_native on both platforms with selective plugin registration
Drop desktop_multi_window entirely; unify macOS + Windows on
multi_window_native. Windows runner re-gets the CreateNewWindow /
CloseWindow / SetMainWindowMethodHandler plumbing with selective
sub-engine registration (only WindowManagerPlugin +
MultiWindowNativePlugin) to avoid the deadlock caused by full
RegisterPlugins on secondary engines. macOS MainFlutterWindow narrows
onEngineCreatedCallback from RegisterGeneratedPlugins to the same two
plugins for consistency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 11:14:05 +02:00
Jonas Bark
3ea37b6c06 overlay/desktop: diagnose Windows white-window by skipping sub-engine plugins
Both desktop_multi_window and multi_window_native produce a white
empty sub-window on Windows, and no Dart prints reach the console.
Two-pronged diagnostic:

1. Liveness via file write. The sub-engine's stdout/stderr may not
   route to `flutter run`'s captured streams. Write a line to
   `%TEMP%/bikecontrol_dart_alive.log` as the FIRST thing in main();
   if the file appears after toggling the overlay, Dart is running
   and we just couldn't see its console output.

2. Skip RegisterPlugins on the desktop_multi_window sub-engine. The
   common factor between BOTH packages failing the same way is the
   ~20 Windows plugins in this app — several own process-singleton
   resources (windows_iap, smtc_windows, BLE, key hooks) already
   held by the main engine. Re-registering them on a second engine
   in the same process may not error but can deadlock the secondary
   engine's bring-up before Dart main runs. If skipping registration
   unblocks Dart, we'll add back the small handful the overlay
   actually needs (desktop_multi_window + window_manager).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 10:55:05 +02:00
Jonas Bark
20fc10395d overlay/desktop: use desktop_multi_window on Windows, keep multi_window_native on macOS
Add `desktop_multi_window: ^0.3.0` alongside `multi_window_native: ^1.0.4`.
On Windows the sub-window is now spawned via `WindowController.create` with a
JSON `role=trainer-overlay` argument (detected in `main()` before any heavy
bootstrap), and state/actions flow over `WindowMethodChannel(kOverlayChannel)`.
macOS continues using `MultiWindowNative.createWindow` / `notifyAllWindows` /
`registerListener` unchanged.

Windows runner reverts all `multi_window_native` plumbing:
`SecondaryWindowContext`, `CreateNewWindow`, `CloseWindow`,
`SetMainWindowMethodHandler`, and the plugin source compiled directly into the
runner are removed. `flutter_window.cpp` instead registers
`DesktopMultiWindowSetWindowCreatedCallback` so every sub-engine gets plugins.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 10:33:14 +02:00
Jonas Bark
a6f55d7355 overlay/desktop: add sub-engine ping MethodChannel for liveness check
Dart prints don't appear in the console for the sub-engine even though
native milestones fire correctly. Need to determine whether:

  (a) Dart main() actually runs but its print/stderr output isn't
      reaching the console attached to `flutter run`, or
  (b) Dart main() never runs at all.

Add a roundtrip diagnostic:
- Native registers a MethodCallHandler on
  `bike_control/sub_engine_ping` for the sub-engine.
- Dart main() invokes that channel as its first await.
- Native prints "[multi_window_native] sub-engine PING received" when
  the call lands.

If the PING line appears: Dart IS running — the issue is print routing.
If it doesn't: Dart never starts and we have to look at engine setup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 10:22:46 +02:00
Jonas Bark
8a520141c8 overlay/desktop: add boot-stage diagnostics
Only "CreateNewWindow with 3 arg(s)" appears in the console, no Dart
prints. That means either (a) the sub-engine never invokes Dart main(),
or (b) Dart prints from the sub-engine aren't reaching the attached
console. Add:

- print() + stderr.writeln() at the VERY TOP of main(), before anything
  that could throw — confirms Dart entry-point resolution.
- std::cerr at every milestone inside CreateNewWindow — confirms the
  native side gets through FlutterViewController/Win32Window/
  RegisterPlugins/SetChildContent without bailing silently.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 10:13:34 +02:00
Jonas Bark
b5a300db66 overlay/desktop: add diagnostic prints to sub-window boot
Even a flat Container doesn't render in the sub-window on Windows.
Need to know whether Dart main() reaches runApp at all — if
`wm.windowManager.waitUntilReadyToShow()` or `getId()` blocks, the
engine never gets widgets to paint and we see the Win32 background
brush regardless of widget tree.

These prints land on the console attached to `flutter run` and will
show us the exact step that stalls.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 10:00:08 +02:00
Jonas Bark
c39d4191f6 overlay/desktop: switch to multi_window_native
Drops desktop_multi_window 0.3.0 in favour of multi_window_native 1.0.4
on a new branch (feature/trainer-overlay-multi-window-native).

Mechanism is different but the responsibilities map cleanly:
- `MultiWindowNative.createWindow([routeName, argsJson, theme])` spawns
  the sub-window; main() detects it via the first arg.
- Communication is broadcast by method name through
  `notifyAllWindows` + `registerListener`. Conventions:
    main → overlay: trainerOverlay.state
    overlay → main: trainerOverlay.action / ready / positionChanged
  Each side filters by method name; the API has no per-window targeting.
- The overlay window grabs its windowId via `windowManager.getId()` and
  broadcasts `trainerOverlay.ready` so the controller can later close it.
- `notifyUiRendered()` is called after the first frame, per the package's
  black-screen workaround on macOS/Windows.

Native shims:
- macOS MainFlutterWindow.swift: re-register plugins on every new
  sub-engine via `MultiWindowNativePlugin.onEngineCreatedCallback`. Kept
  the `.statusBar` / `.fullScreenAuxiliary` elevation for visibility
  above fullscreened trainer apps; the callback now finds the new
  sub-window's NSWindow by matching the FlutterViewController's engine.
- Windows flutter_window.cpp: reverted the desktop_multi_window callback;
  multi_window_native's Windows wiring requires a more invasive
  flutter_window.h / cpp change (SetOnCloseCallback, GetFlutterViewController,
  callback registration in main.cpp) which is TBD. The overlay is only
  verified on macOS in this branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 09:11:00 +02:00
Jonas Bark
5eff383ea9 fix init 2026-05-11 09:04:43 +02:00
Jonas Bark
5a803b2a18 fix android 2026-05-10 09:36:13 +02:00
Jonas Bark
ce592adc1d overlay: add sub-window entry point and dispatch from main()
Add lib/services/overlay/desktop_overlay_window.dart with
runDesktopOverlayWindow(): configures the sub-window via window_manager
(220×140, frameless, transparent, always-on-top), registers a
setWindowMethodHandler for 'state'/'close' calls from the parent, and
routes 'hide'/'toggleMode'/'positionChanged' back via WindowMethodChannel.

Update main() to call WindowController.fromCurrentEngine() after
WidgetsFlutterBinding.ensureInitialized(); if the arguments indicate
role=trainer-overlay it dispatches to runDesktopOverlayWindow and
returns early, keeping all heavy init (Settings, IAP, Supabase) out of
the sub-window process.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 16:12:22 +02:00
Jonas Bark
bce7041520 feat(overlay): mount TrainerOverlayHost at app root for desktop compact mode
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 09:07:35 +02:00
Jonas Bark
7bd39748bc fix 2026-04-26 13:02:06 +02:00
Jonas Bark
eabe519188 UI improvements 2026-04-25 22:36:25 +02:00
Jonas Bark
c2d41f7226 feat(shifting): mount ShiftingConfigsController on core 2026-04-20 07:38:22 +02:00
Jonas Bark
af1203d841 add blog posts to BikeControl 2026-03-25 10:17:08 +01:00
Jonas Bark
59b8ec48ea show already unlocked when user manually unlocked it 2026-03-25 09:40:56 +01:00
Jonas Bark
b1e3fda6d2 revise revenuecat initialization 2026-03-20 07:58:23 +01:00
Jonas Bark
c2d3a76e05 updated screenshots 2026-03-13 20:47:27 +01:00
Jonas Bark
ffd178d523 translations 2026-03-12 10:50:07 +01:00
Jonas Bark
158764a654 new ui #20 2026-03-12 10:40:01 +01:00
Jonas Bark
e6257daa29 new ui #20 2026-03-12 10:23:21 +01:00
Jonas Bark
788c8bef06 new ui #19 2026-03-12 10:11:17 +01:00
Jonas Bark
da041daa3c new ui #19 2026-03-12 07:58:13 +01:00
Jonas Bark
47953a6cec new ui #17 2026-03-11 20:31:27 +01:00
Jonas Bark
76bc8f5175 new ui #14 2026-03-11 19:30:29 +01:00
Jonas Bark
c332fa7704 new ui #12 2026-03-11 17:35:26 +01:00
Jonas Bark
6d2b70345d new ui #11 2026-03-11 16:52:19 +01:00
Jonas Bark
a2ed9915f3 new ui #10 2026-03-11 15:13:00 +01:00
Jonas Bark
272d5d4e35 new ui #8 2026-03-11 13:31:23 +01:00
Jonas Bark
0e22de93db new ui #5 2026-03-10 21:02:41 +01:00
Jonas Bark
14e30c2d56 new ui #3 2026-03-10 15:51:19 +01:00
Jonas Bark
97318ffa1c new ui #1 2026-03-10 12:35:36 +01:00
Jonas Bark
0ecd604f57 no longer build self signed MSIX 2026-03-06 18:12:09 +01:00