Commit Graph

108 Commits

Author SHA1 Message Date
Jonas Bark
c00c699488 feat(onboarding): offer a waiting update before setup starts
Extracts AppTitle's private update logic into lib/services/app_update.dart
(Shorebird patch first, then the platform store) so the title bar and the
wizard share one definition of 'an update is available' and one way to
apply it. The wizard shows it on the mobile welcome screen, or on desktop's
step 1 where there is no welcome screen — never twice.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 07:38:37 +02:00
jonas.bark@gmx.de
7e58213dc2 chore: drop the mDNS query listing from diagnostics
It was added while chasing the network discovery problem and is not useful
now that the cause is fixed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 14:44:01 +02:00
Jonas Bark
274a6ba634 diag: show repeat counts in the mDNS query log; bump prop submodule
Renders "×N" on folded entries so a continuous poller reads as one line that
fired N times rather than silently occupying one slot. Single occurrences stay
unmarked.

Picks up the prop-side fold + the 40 -> 200 ceiling, after a field capture
filled the whole buffer in eight seconds and lost the window that mattered.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PanTG9kRBi4QTQ2psvpTxP
2026-07-30 21:52:25 +02:00
Jonas Bark
8b8b94b0af fix(diagnostics): surface received mDNS queries; bump prop submodule
Adds the "mDNS queries received" section to the diagnostics report, listing
each query the responder saw with its source, the QU bit and whether the reply
went out unicast, multicast, both or not at all.

This is the missing half of diagnosing "the trainer app on this machine can't
find BikeControl". A same-host querier appears with the advertised address as
its source, so the report now distinguishes three very different situations:
the app never queried us at all, it queried for the service (PTR/SRV — the
browse step), or it queried for our hostname (A — the resolve step). Empty on
iOS, where the OS responder handles queries and never reports them to us.

Picks up the prop-side fix for the Windows shared-port QU delivery problem.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PanTG9kRBi4QTQ2psvpTxP
2026-07-30 13:11:24 +02:00
Jonas Bark
db5cc74a12 fix(erg,sram): shared ERG stepping with boundary guards; scope §7 guard to shifting-enabled; coalesce iOS echo presses
ERG (review findings on the ±5W change):
- New ErgPowerStepping extension is the single home for the 5W step and
  500W manual cap, replacing 7 inline copies (physical buttons, hero-card
  buttons/slider, three overlay controllers).
- Boundaries are guards, not clamps: up at >=500W is a no-op like the
  disabled UI button (a 600W FTMS target is no longer slashed to 500),
  down from >500W steps relative, and an unknown baseline (hub-commanded
  ERG reports no target) is a no-op with a new localized message instead
  of slamming the trainer to ~150W.
- ERG shift-up Success carries the button again so +5W presses show
  activity feedback (missed conversion from 843f7985).

SRAM gesture:
- Same-lever repeats inside the 90ms combo window coalesce as duplicates:
  a finger can't re-press in 90ms, but iOS re-delivers a colliding read
  response of the 0xFF edge through the notify callback — it must not
  actuate twice (nor break a combo when it misdecodes to the other lever).
- The §7 multishift guard only runs while shifting is enabled — the one
  state where a held paddle actually bursts (per c94b87f0's --observe
  capture). Bonded rapid tapping and both-lever combos are never
  throttled. Timer-driven instead of DateTime.now() (deterministic under
  fakeAsync) and cleared by _resetGesture on (re)connect.
- The "set up SRAM control" warning fires once per connection, not on
  every undecoded press.

Harness:
- EmulationSession.notify drops notifications for removed peripherals so
  delayed notifies (SRAM double-tap) can't land after teardown.
- The 0xFF press edge is SramAxsConstants.triggerEdge at all call sites;
  the emulation test waits on the named TRIGGER_UUID constant.
- New coverage: guard behavior through processCharacteristic in both
  states, burst suppression while unbonded, all-taps-delivered once
  bonded, ERG boundary/game-set-target cases.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:51:35 +02:00
Jonas Bark
82917c3c9d fix(overlay): widen drag hit area; fix PiP show/hide race; orientation-safe DI detection
- The floating overlay's drag handle now fills the full 24px trailing slot
  instead of only the 14px icon.
- iOS overlay: arm PiP only while still showing and tear it down if a hide
  lands mid-start(), so a show/hide race can't orphan a frozen PiP window.
- Detect Dynamic Island via the max safe-area inset instead of the top inset,
  which collapsed in landscape and could auto-start an unwanted PiP.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 19:58:26 +02:00
Jonas Bark
69088cbb7f fix(screen-recording): guard re-entrant toggle; recover native start failures
- Ignore toggles during the transient starting/stopping states (in-flight
  guard) so a double-press can't double-start or stop-during-start.
- macOS: reset the recorder handle when start() throws, so one failure no
  longer permanently blocks recording (only stop() nilled it before).
- iOS: remove the broadcast picker view after triggering so a 1x1 view doesn't
  accumulate on the key window on every start.
- Report failures via recordError (was debugPrintStack, which vanishes in
  release builds). Adds an in-flight-toggle guard test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 19:58:26 +02:00
Jonas Bark
ff57b005d5 feat(shifting): show 2×N gear position when the front derailleur is active
With the virtual front derailleur on, the compact gear readout switches
from rear gear/total (14/25) to head-unit-style front×rear position
notation (small ring 1×N, large ring 2×N, e.g. 2×14) — matching how
Garmin/Wahoo display Di2/AXS gearing. With it off, it stays 14/25.

- Add tested formatGearReadout helper.
- Wire into the proxy card, debug menu, desktop second window + Android
  PiP/overlay (trainer_overlay_view), and the gear hero card (2× · 50T).
- Carry frontShiftEnabled + frontRingLarge through TrainerOverlayState
  (json, ==, hashCode, activity map) so the snapshot reaches the overlay
  and the iOS surfaces.
- iOS PiP + Live Activity: format 2×N centrally in GearSnapshot.
- Standardize the off-state readout to 14/25 across all surfaces.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 15:02:40 +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
b60876e6dd feat(pip): opt-in on Dynamic-Island iPhones + immediate floating window on iPad
- New "Floating window (Picture-in-Picture)" overlay setting (iOS 16+). Default
  follows the per-device auto behavior (on for iPad / non-DI iPhones, off for
  Dynamic-Island iPhones); DI-iPhone users can opt in. The Live Activity keeps
  running alongside it (additive).
- iPad: start PiP immediately on activation (foreground) instead of only when
  backgrounded — there's screen room (DeviceCapabilities.prefersForegroundPip +
  scheduleForegroundStart poll).
- DeviceCapabilities.isPipCapable (any iOS 16+ PiP device) + bike_control/pip_ios
  "isCapable"; settings.getOverlayUsePip/setOverlayUsePip; show() resolves the
  preference.
- requiresLinearPlayback = true to drop the PiP skip/scrub (next/prev) controls
  (it's a live HUD; central play/pause is system chrome, harmless no-op).
- overlayUsePip + overlayUsePipSubtitle in all 6 languages; changelog updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 18:50:33 +02:00
Jonas Bark
842eaeab4d fix(overlay): guard PiP stop() in hide() so _pipActive always resets
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 18:19:46 +02:00
Jonas Bark
f4130d1dad feat(overlay): drive PiP gear window from IosOverlayController on eligible devices 2026-06-24 18:19:46 +02:00
Jonas Bark
69af34f1cb feat(overlay): add IosPipController + shared overlayStateToActivityMap 2026-06-24 18:19:46 +02:00
Jonas Bark
c597d5ebc1 fix(6.2): screen_recorder plugin declares no native platforms yet (unblock macOS/Windows builds) + comment/semantics tidy
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 17:05:18 +02:00
Jonas Bark
d1ecbe2cbc feat(6.2): Android screen recording backend (MediaProjection + gallery save) 2026-06-24 16:51:58 +02:00
Jonas Bark
9185d71a92 feat(6.2): register core.screenRecording with platform backend factory 2026-06-24 16:30:54 +02:00
Jonas Bark
f9df89984e fix(6.2): screen recording service never-throws contract + startedRecording semantics 2026-06-24 16:23:29 +02:00
Jonas Bark
f803677b22 feat(6.2): add ScreenRecordingService with testable backend seam 2026-06-24 16:19:50 +02:00
Jonas Bark
7ab6c6959b style: sort diagnostics TXT entries alphabetically by key 2026-06-22 17:00:17 +02:00
Jonas Bark
ae2943c752 style: tidy diagnostics Permissions line; omit when nothing to show 2026-06-22 12:27:11 +02:00
Jonas Bark
dc2467566e refactor: drop Bluetooth/Location from diagnostics permissions; keep iOS local-network inference 2026-06-22 12:14:07 +02:00
Jonas Bark
0008e173a2 feat: label OpenBikeControl TCP server; gate iOS local-network inference to iOS 2026-06-22 10:53:56 +02:00
Jonas Bark
0e38f0d819 feat: add DebugDiagnostics aggregator and text formatter 2026-06-22 10:30:24 +02:00
Jonas Bark
cefd5bf0a6 feat: add mDNS discovery scan for diagnostics (openbikecontrol + wahoo) 2026-06-22 10:27:06 +02:00
Jonas Bark
a6f409f9ea misc fixes 2026-06-18 17:48:25 +02:00
Jonas Bark
0a76de870a refactor: ProxyDevice owns trainer identity and def construction
handleServices builds both ProxyBikeDefinition and
FitnessBikeDefinition up front and attaches to the right emulator
based on retrofit mode. ProxyDevice provides advertisementName +
mdnsTxt to ftmsEmulator/_proxyEmulator via the new startServer
parameters. Drops DirconEmulator state mirroring that's no longer
needed. ZwiftClickV2 no longer calls startServer (click-alone
path removed per prop strip). UI consumers route through
ProxyDevice.advertisementName and device.retrofitMode.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 00:08:33 +02:00
Jonas Bark
9fb8d63f9a refactor: collapse to a single shared DirconEmulator for VS mode
ftmsEmulator is now the single emulator for Virtual Shifting traffic
across all trainers and the Click V2. ProxyDevice keeps a per-instance
emulator only for proxy mode (each proxy trainer advertises its own
mDNS identity). ZwiftClickV2 attaches its def to ftmsEmulator directly.

ProxyDevice exposes its own state ValueListenables (isStartedListenable,
isConnectedListenable, retrofitMode, localAddress) that mirror the active
emulator, so UI bindings survive mode swaps. setRetrofitMode and
switchRetrofitMode live on ProxyDevice and migrate the FBD between
proxy/shared emulators.

Removes companionProvider, refreshCompanions, and the click-def
internal seeding in DirconEmulator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 23:05:40 +02:00
Jonas Bark
a795b3c681 refactor: route FBD-specific callers through emulator.fitnessBike
activeDefinition now returns the CompositeBleDefinition; consumers
that need the FitnessBikeDefinition specifically use the fitnessBike
convenience getter. Bumps prop submodule to pick up the composite
machinery.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 17:55:53 +02:00
Jonas Bark
6f4bdad16c Support chat: intake form on new chats
Adds a small intake form to the new-chat empty state — users pick a
problem category (trainer app / controller / smart trainer / account)
plus a follow-up, see matching public issues with optional blog/video
links, and the answers ride along with the first message as JSON for
later analysis. Translations added for de/es/fr/it/pl.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 19:10:07 +02:00
Jonas Bark
3d6ae98c09 filter issues 2026-05-17 10:37:46 +02:00
Jonas Bark
106bea2857 show known open issues at the top of the Support chat
So users can spot already-tracked problems before opening a chat.
Each title links to https://bikecontrol.app/issues/{id}.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 08:40:50 +02:00
Jonas Bark
ffbc5d64f0 overlay/ios: add Dynamic Island stop button that disconnects all devices
Replaces the trailing mode pill in the Dynamic Island expanded
region (which was redundant — the bottom row already shows the
SIM/ERG pill) with an `xmark.circle.fill` button.

Tapping the button:
1. Fires a new `StopRideIntent` App Intent.
2. That intent posts a Darwin notification
   `de.jonasbark.swiftcontrol.overlay.action.stop`.
3. `AppDelegate.swift`'s observer forwards `action: 'stop'` over
   the `bike_control/overlay_actions_ios` MethodChannel.
4. `IosOverlayController._stopRide`:
     - `core.connection.disconnectAll()`
     - `core.connection.stop()`
     - `core.settings.setOverlayEnabled(false)` so Navigation's
       auto-show doesn't immediately re-open the activity on the
       next BLE reconnect.
     - `hide()` ends the Live Activity.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 09:42:56 +02:00
Jonas Bark
5b2baf2e85 screenshots & iOS build 2026-05-13 09:30:13 +02:00
Jonas Bark
8bf449e2f4 Merge branch 'vs-improvements-asin-cw-cadence-filter' into feature/trainer-overlay-multi-window-native
VS improvements ported from Tacx-Virtual-Shifting (Berg0162):
- asin clamp + int saturation in calculateFECTrackResistanceGrade (#4a)
- cw plumbing from FTMS / Zwift envSim into VS physics calc (#7)
- opt-in CadenceFilter (median + power-aware jump limiter) (#9)
- ShiftingConfig.cadenceFilterEnabled + proxy seed
- telemetry: cadence_filter_enabled in support payload
- UI toggle in gear-ratios editor + 6-locale ARB translations

Plan: docs/superpowers/plans/2026-05-12-vs-improvements-asin-cw-cadence-filter.md
2026-05-13 09:06:39 +02:00
Jonas Bark
390d09b964 UI adjustments, add screenshot to support 2026-05-13 09:05:48 +02:00
Jonas Bark
33f786ab6d telemetry: include cadenceFilterEnabled in support payload
Without this, in-the-wild VS reports can't be correlated with whether
the new opt-in spike filter was active. Mirrors the existing
gradeSmoothing → grade_smoothing plumbing.
2026-05-13 08:40:49 +02:00
Jonas Bark
2b72b64f8e overlay: re-resolve live FitnessBikeDefinition + fix macOS close + recordError
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>
2026-05-12 12:48:53 +02:00
Jonas Bark
eed4b66e69 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
4f28061c9f overlay/desktop: fix macOS sub-window size + fullscreen elevation timing
Two macOS regressions reported by the user:

- Initial sub-window size way too large. multi_window_native's macOS
  plugin hard-codes the sub-window at 1000x1000 with minSize 800x900
  (see plugin source createNewWindow ~line 148). Override from Dart
  in `_runOverlay`: setMinimumSize(180, 100) then setSize(220, 140).

- Overlay no longer appears above fullscreened trainer apps. The
  plugin fires `onEngineCreatedCallback` BEFORE it creates the
  NSWindow + sets its contentViewController, so our previous single
  `DispatchQueue.main.async { ... }` raced the plugin's own setup and
  found nothing in NSApp.windows. Retry up to 30 times (0.1s apart)
  until the window with our `engine` appears, then apply
  `.statusBar` level + `.fullScreenAuxiliary` collection behaviour.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 12:05:41 +02:00
Jonas Bark
4f1edaa029 fix background 2026-05-12 11:56:48 +02:00
Jonas Bark
f4a5469c22 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
805d0e410c 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
7c06b3330f 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
1331d6eb3c 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
2470c4ad4b overlay/desktop: drop WindowOptions setup that wedges the Windows sub-window
`waitUntilReadyToShow(WindowOptions(...))` tries to apply size +
titleBarStyle + backgroundColor + alwaysOnTop all at once. On Windows
that combination misbehaves:

- `Colors.transparent` background can't be honoured without
  `WS_EX_LAYERED`, so it ends up filling the window with white.
- `TitleBarStyle.hidden` rewrites window styles mid-startup, which the
  sub-window's render surface doesn't recover from — the engine paints
  once at the wrong size and then sits idle.

The package example's `SecondScreen` never calls `waitUntilReadyToShow`
with options. Match that: apply each setting individually after the
engine boots — set alwaysOnTop, minimumSize, hasShadow, and (macOS only)
visibleOnAllWorkspaces. No titleBarStyle/backgroundColor on Windows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:35:46 +02:00
Jonas Bark
7d151cbc2c overlay/desktop: fix sub-window first-frame + visibility on Windows
Two issues caused the sub-window to show as "all white initially, white
box on black after resize":

- The runner's CreateNewWindow skipped FlutterWindow::OnCreate's engine
  kickoff (`SetNextFrameCallback` + `ForceRedraw`). The sub-window's
  engine then never spontaneously painted and stayed at its construction
  metrics; a manual resize forced a paint but with the old 220x100
  surface, hence the "white box that doesn't follow the window".
  Replicating the same boot sequence in CreateNewWindow.

- The Scaffold background used `Theme.of(context).colorScheme.background`,
  which resolves to near-white under shadcn's light theme, masking the
  gear card on its near-white surface. Win32 doesn't do real transparency
  without WS_EX_LAYERED anyway, so use an explicit opaque dark colour
  (0xFF111114) — gives the window a clear chrome regardless of the
  user's system theme.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:25:48 +02:00
Jonas Bark
c771329f79 fix dynamic island 2026-05-11 14:13:19 +02:00
Jonas Bark
9f4e038df3 fix multi window macOS 2026-05-11 10:02:09 +02:00
Jonas Bark
40d297ba64 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
f51ab099b7 android: silence the trainer-overlay foreground-service notification
Android's SYSTEM_ALERT_WINDOW + specialUse foreground service requires
*some* notification — we can't suppress it entirely. Empty the content
line and set visibility to secret so it doesn't appear on the lock
screen or as a heads-up; it lives unobtrusively in the notification
shade only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 07:56:16 +02:00