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>
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.
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.
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>
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().
- 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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>