mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-12-04 20:52:23 +01:00
Fixes the user-reported bugs after the auto-show landed:
1. Auto-opened overlay buttons did nothing
The trainer emulator rebinds a fresh FitnessBikeDefinition each time
its transport restarts (e.g. when a trainer app connects), so the
`def` captured at show() time can already be stale by the time the
user taps + / −. Action handlers now re-resolve through a new
`LiveDefinitionLookup` callback on every dispatch. Navigation's
auto-show and OverlaySettingsSection's manual show both pass a
lookup that reads `device.emulator.activeDefinition` live.
2. Toggling "Show overlay during ride" off didn't close the panel
The vendored macOS plugin's `closeWindow` handler ignored its args
and called `closeWindow(NSApp.mainWindow)`, which either terminated
the app or no-op'd silently. Patched it to honor
`isMainWindow: false` and close the (single) secondary window.
3. "Error in overlay.position.decode: Unexpected character: light"
The vendored macOS plugin packs the Dart entrypoint args in the
order [routeName, theme, argsJson]; the Windows runner uses
`std::map` iteration order. The sub-window was indexing `args[1]`
blindly. Now it scans `args[1..]` for the first JSON-looking
payload with `x`/`y`.
Also:
- TrainerOverlayController.show now takes optional `liveDef`; all
three implementations (desktop, android, ios) thread it through.
- Navigation initState no longer early-`return`s after auto-show, so
the post-frame system-UI / changelog logic still runs.
- All silent `catch (_) {}` blocks in the overlay code now forward
via `recordError(e, s, context: '...')`. New project memory
entry [feedback_record_error.md] documents the rule.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>