Commit Graph

44 Commits

Author SHA1 Message Date
Jonas Bark
905c2641cd feat(ios/macos): detect the Local Network permission instead of failing silently
Denial of Apple's Local Network privacy permission is the most common cause of
"BikeControl can't see my trainer app" on iOS and macOS, and it fails
completely silently: Bonjour browses return nothing forever, advertisements
never leave the device, nothing throws. An app watching only for errors cannot
tell "permission is off" from "there is nothing out there".

Apple ships no authorization-status API for it (not iOS 14...26, not macOS
15...26), so the new local_network_permission plugin measures it: an NWListener
and an NWBrowser on _bikecontrol-preflight._tcp, then

  browser discovers the listener        -> granted
  kDNSServiceErr_PolicyDenied (-65570)  -> denied
  neither, before the deadline          -> unknown

unknown is a real outcome, not an error — a device with no usable network never
completes the round trip even when the permission is fine — so everything fails
open on it and only a positive denial blocks the user.

The probe *is* the request: the system prompt fires on the first Bonjour
operation, so there is no separate request step, and after the user answers,
System Settings is the only way back.

- LocalNetworkAccess caches the result (probes cost a real round trip while
  getStatus() runs on every tile mount, tap and resume) and collapses
  concurrent probes into one, since two listeners on the same service type
  would resolve each other.
- LocalNetworkRequirement gates the three LAN tiles: MyWhoosh Link, Zwift mDNS
  and OpenBikeControl mDNS. Suppressed in screenshot/demo mode like the rest.
- Diagnostics drop the old guess (inferred from whether a discovery scan
  returned anything, which could not tell denied from an empty LAN) for the
  measured local-network=granted|denied|unknown.
- _bikecontrol-preflight._tcp added to NSBonjourServices on both platforms;
  without it the browse fails for a reason unrelated to the permission.

The Xcode project deployment-target bumps (ios 13.0->15.0, macos 10.15->12.0)
are Flutter's own migration aligning project defaults with the Podfiles; they
happen on any first build.

Verified with real builds on both platforms, not just analysis: flutter build
macos --debug and flutter build ios --no-codesign both succeed, the framework
is linked in, and the preflight service type is present in both built
Info.plists. 35 tests cover the mapping, cache, concurrency and fail-open
behaviour.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 07:58:18 +02:00
Jonas Bark
87642a9926 feat(6.2): macOS screen recording backend (ScreenCaptureKit)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 17:28:09 +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
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
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
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
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
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
c847a10ed1 some fixes 2026-05-09 10:26:52 +02:00
Jonas Bark
8167f16ee9 fill prop_public 2026-04-26 11:02:23 +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
655c01ad85 downgrade path_provider_foundation to potentially fix crash issue
https://www.facebook.com/groups/1892836898778912/posts/1977263700336231/?comment_id=1981595913236343&notif_id=1774027006680009&notif_t=group_comment
2026-03-20 18:24:39 +01:00
Jonas Bark
ada54e05eb create screenshot on Windows + macOS 2026-02-25 20:57:12 +01:00
Jonas Bark
d3f64d3f1d Windows: run any command 2026-02-23 09:07:45 +01:00
Jonas Bark
e1a7aac3e4 sign in with google, apple 2026-02-16 16:26:22 +01:00
Jonas Bark
bd8c51d6ee iOS: keep app alive in background 2026-02-06 12:51:47 +01: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
7fac3390b1 update dependencies 2026-01-19 11:01:42 +01:00
Jonas Bark
f389993ea0 implement logic 2025-12-26 18:48:57 +01:00
Jonas Bark
b69d41ecb5 in app purchase implementation on macOS / iOS 2025-12-14 19:32:23 +01:00
Jonas Bark
0ce74099fb Merge branch 'main' into copilot/implement-in-app-purchase
# Conflicts:
#	lib/bluetooth/devices/base_device.dart
#	lib/pages/configuration.dart
#	lib/utils/settings/settings.dart
2025-12-14 16:42:50 +01:00
Jonas Bark
5cbf864604 work on mDNS 2025-12-05 11:14:16 +01:00
Jonas Bark
6b5ad1d9ce wording 2025-12-01 13:40:00 +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
e281a44bf9 store background image during touch editing, don't show auto rotation warning when not needed 2025-10-26 19:45:11 +01:00
Jonas Bark
fb43ddf024 initial support for gamepads 2025-10-26 10:21:59 +01:00
Jonas Bark
15723a9d4e - keep iOS app alive when in background
- keep app active on iOS to keep the remote control happy
- reconnect when this was ignored
2025-10-09 09:51:47 +02: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
7e3f16e076 fix bluetooth scan issues on older Android devices by asking for location permission 2025-04-07 12:48:20 +02:00
Jonas Bark
3d5c0770a7 Desktop: add mouse click support 2025-04-06 13:30:59 +02:00
Jonas Bark
d83b9985ea version update check => internet permission is required 2025-03-31 20:58:27 +02:00
Jonas Bark
0bb0b7f74d Android: allow user to adjust touch placements 2025-03-30 14:26:51 +02:00
Jonas Bark
4a2b3b1a9b allow adding custom keymap and store it 2025-03-30 13:36:40 +02: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
73bf894cd0 foreground notification on Android 2025-03-27 17:44:27 +01:00
Jonas Bark
f0050167a8 integrate flutter blue plus windows 2025-03-27 16:56:46 +01:00
Jonas Bark
9e34c99aaf requirements rework 2025-03-27 14:53:38 +01:00
Jonas Bark
7ab8ca0a8d connection to click 2025-03-26 18:12:56 +01:00
Jonas Bark
793ed76100 initial commit 2025-03-26 15:41:06 +01:00