Commit Graph

55 Commits

Author SHA1 Message Date
Jonas Bark
a4ee87e85f feat(6.2): Windows screen recording backend (WGC + Media Foundation) [UNVERIFIED — needs Windows build]
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 17:42:15 +02:00
Jonas Bark
1b131b312a chore(6.2): lock new deps + regenerate plugin registrants (gal; no screen_recorder native yet) 2026-06-24 17:12:27 +02:00
Jonas Bark
0ba398b2c9 Merge branch '6.0.0' into custom-mdns-responder 2026-06-12 09:16:15 +02:00
Jonas Bark
3198c6f4ed Silence STL1011 so plugin C++/WinRT code builds with VS 2026's MSVC
Pinning the runner image didn't help: GitHub's windows-2025 image now
ships VS 2026 too (Image: windows-2025-vs2026), whose STL turns the
experimental-coroutine deprecation into a hard error in
bluetooth_low_energy_windows and permission_handler_windows. Define
Microsoft's documented escape hatch at the project level so all plugin
subprojects inherit it. Affects both shorebird patch and release builds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 08:04:39 +02:00
Jonas Bark
a60a1384e3 Merge origin/universal-ble-2-peripheral: universal_ble 2.0.0 peripheral mode
Brings the BLE peripheral-mode migration to universal_ble 2.0.0 into the
WiFi DirCon trainer-discovery branch and bumps universal_ble to the latest
fork commit (ref: changes, 2.0.0).

Conflict resolutions:
- prop submodule: merged the universal_ble 2.0 transporter migration with
  the WiFi DirCon TrainerTransport refactor; kept the '0x' short-UUID
  normalisation on startAdvertising. Updated BleCharacteristic call sites
  to the new 3-arg (uuid, properties, descriptors) constructor.
- obc_ble_emulator.dart: took the PeripheralServer / universal_ble 2.0
  write-handler migration; kept the richer Error(button:) context on
  sendAction (using _currentDeviceId, the migrated connection tracker).
- unlock.dart: kept the main.dart import.
- pubspec.yaml: kept version 6.0.0+135; took ref: changes for universal_ble.

Pre-existing prop test failures (composite/dircon/fitness serviceUUIDs) are
unchanged by this merge — they fail identically on the pre-merge branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 09:19:58 +02:00
Jonas Bark
29741e520f migrate peripheral mode to universal_ble 2.0.0
Drop bluetooth_low_energy. Move OBC BLE emulator, Zwift emulator, and
the remote mouse / keyboard pairing flows onto a new PeripheralServer
wrapper around UniversalBlePeripheral that routes per-characteristic
read/write handlers, so multiple peripheral instances coexist without
clobbering universal_ble's process-wide handlers.

Also: onValueChange callback gains a timestamp param (v1.0.0 breaking
change), PeripheralManager().showAppSettings() → openAppSettings(),
UUID.short(0x12) → literal UUID, and prop submodule bumped to the
matching universal_ble peripheral rewrite.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 09:28:39 +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
219a32b793 windows: route sub-window plugin channel through runner's static state
Confirmed via the [main:wm-spy] diagnostic that broadcasts from the
sub-window weren't reaching main's Dart. Root cause: two copies of
MultiWindowNativePlugin exist in the binary.

The plugin DLL (built by flutter pub get) has its own static
`messengers_` field. We also compile multi_window_native_plugin.cpp
directly into the runner so wWinMain can call
MultiWindowNativePlugin::SetCreateWindowCallback etc. — the runner
has a SECOND copy of those statics. They don't share state.

Previous flow:
  - Runner's RegisterMessenger (called by SetMainWindowMethodHandler)
    adds main → RUNNER's messengers_.
  - Sub-engine plugin was registered via the DLL's
    MultiWindowNativePluginRegisterWithRegistrar, which calls the
    DLL's BroadcastToAll on broadcast → DLL's messengers_ (empty
    except for the sub itself).

Fix: stop registering the DLL plugin on the sub-engine. Instead wire
the MethodChannel handler directly in CreateNewWindow — same logic
SetMainWindowMethodHandler uses on the main engine — so the sub-window's
broadcasts go through the RUNNER's copy of BroadcastToAll and iterate
the same messengers_ list that contains main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 11:54:09 +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
15a04604ab windows: register only window_manager + desktop_multi_window on sub-engine
Confirmed: calling RegisterPlugins (every plugin) on the secondary
engine deadlocks its boot before Dart main() runs. With registration
skipped entirely, Dart runs and we get MissingPluginException on
window_manager.ensureInitialized() — which means the overlay can now
launch as soon as it has just the plugins it actually uses.

Register only:
- WindowManagerPlugin — needed for size, position, alwaysOnTop, etc.
- DesktopMultiWindowPlugin — needed for the WindowMethodChannel that
  carries state updates from the parent.

The other ~17 plugins (BLE, IAP, key hooks, accessibility, media,
URL launcher, share, screen capture, ...) stay registered on the
MAIN engine only. The overlay never needs them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 11:03:29 +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
51c5f28c54 windows: don't override Dart entry point in sub-window project
`set_dart_entrypoint("main")` looks like a no-op but it routes the
sub-engine through the named-entry-point lookup path, which (at least
on Windows in this app) resolves to nothing — the engine reports OK,
the controller is alive, but Dart main() is never invoked. Removing
the override lets the engine use its built-in default of `main`, which
the snapshot already exposes.

Symptom this addresses: only the four native milestone prints appear
in the console after toggling the overlay
(`FlutterViewController created`, `Win32 window created`, `RegisterPlugins
done`, `SetChildContent done`), and zero output from `[main:entry]`
in Dart.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 10:17:41 +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
706c0de677 Revert "windows: align sub-window creation with FlutterWindow::OnCreate"
This reverts commit e29f79273c.
2026-05-12 09:59:09 +02:00
Jonas Bark
e29f79273c windows: align sub-window creation with FlutterWindow::OnCreate
The example's CreateNewWindow creates the FlutterViewController first
(making its view HWND a top-level WS_POPUP) and then reparents it via
SetChildContent. Eagerly calling ShowWindow before the engine has
signalled its first frame means we present an unpainted surface, and
the engine can land in a "frame already presented" state where it
never repaints — matching the user's "even a flat red Container
doesn't show" symptom.

Restructure CreateNewWindow to match FlutterWindow::OnCreate exactly:
- Create the Win32 window first.
- Use the host's actual client area to size the FlutterViewController.
- Defer ShowWindow + SetForegroundWindow to SetNextFrameCallback so we
  only show the window once the engine has a frame ready to display.
- ForceRedraw to nudge the engine into producing that first frame.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:50:50 +02:00
Jonas Bark
431828089d 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
bc2ecb9282 Windows #2 2026-05-12 09:18:48 +02:00
Jonas Bark
596f851566 Windows adjustments 2026-05-12 09:11:19 +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
8fcca6a18c windows: register plugins on desktop_multi_window sub-window engines
Mirrors the macOS callback wired in MainFlutterWindow.swift. Without
this, the trainer-overlay sub-window's Flutter engine has no plugin
registrations, so WindowMethodChannel calls between parent and overlay
silently fail and the overlay never receives state updates.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 16:13:54 +02:00
Jonas Bark
12fc7eed87 deps: add desktop_multi_window 0.3.0 and wire macOS plugin callback
Add desktop_multi_window ^0.3.0 alongside window_manager. Update
macos/Runner/MainFlutterWindow.swift with the FlutterMultiWindowPlugin
window-created callback so sub-window engines register all generated
plugins automatically. Also includes flutter pub get generated changes to
linux/windows/macos plugin registrants.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 16:07:18 +02:00
Jonas Bark
7c3092c2c9 chore(workout): add fit_tool + share_plus deps and i18n strings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 11:52:43 +02:00
Jonas Bark
ada54e05eb create screenshot on Windows + macOS 2026-02-25 20:57:12 +01:00
jonas.bark@gmx.de
b9478b1bd2 Windows login 2026-02-16 17:14:38 +01:00
Jonas Bark
e1a7aac3e4 sign in with google, apple 2026-02-16 16:26:22 +01:00
copilot-swe-agent[bot]
5b0347a4b8 Update window title from bike_control to BikeControl
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-03 09:38:20 +00:00
Jonas Bark
313c8d6f13 Windows & macOS: allow configuration of volume keys on Bluetooth HID devices 2026-01-22 14:29:57 +01:00
jonas.bark@gmx.de
7dad73a395 fix import 2026-01-13 18:42:42 +01:00
Jonas Bark
16d98702c0 check win package format 2026-01-13 17:57:01 +01:00
Jonas Bark
89016bffc3 windows #1 2025-12-14 19:54:41 +01:00
Jonas Bark
b69d41ecb5 in app purchase implementation on macOS / iOS 2025-12-14 19:32:23 +01:00
Jonas Bark
2528342a7b remove remains of swift_control 2025-12-14 16:22:07 +01:00
Jonas Bark
7a292f8bca media key detection Windows 2025-12-05 17:57:11 +01:00
Jonas Bark
5cbf864604 work on mDNS 2025-12-05 11:14:16 +01:00
Jonas Bark
530d3620a3 fix Windows app icon 2025-11-28 17:49:49 +00:00
Jonas Bark
41828b3469 detect media keys on macOS / iOS #1 2025-11-03 08:58:16 +01:00
Jonas Bark
259c6da088 use clipboard again when sharing 2025-10-27 08:27:08 +01:00
Jonas Bark
800cdf98fa resolve issue #135 2025-10-26 19:48:17 +01:00
Jonas Bark
fb43ddf024 initial support for gamepads 2025-10-26 10:21:59 +01:00
Jonas Bark
182a110dda Revert "try flutter_ble_peripheral"
This reverts commit b9198f8b8d.
2025-10-06 19:28:43 +02:00
Jonas Bark
b9198f8b8d try flutter_ble_peripheral 2025-10-06 19:27:52 +02:00
Jonas Bark
a3883ab7dd try bluetooth_low_energy 2025-10-06 18:46:46 +02:00
Jonas Bark
3d5c0770a7 Desktop: add mouse click support 2025-04-06 13:30:59 +02:00
Jonas Bark
0bb0b7f74d Android: allow user to adjust touch placements 2025-03-30 14:26:51 +02:00
Jonas Bark
71bac6f710 fix missing permissions for Android 2025-03-29 14:34:39 +01:00
Jonas Bark
5698ad0618 integrate universal_ble 2025-03-28 23:14:06 +01:00
Jonas Bark
50fda1d9eb control media (Android only for now), add menu 2025-03-28 15:24:25 +01:00
Jonas Bark
bac12e8dca github actions 2025-03-28 13:45:56 +01:00