Commit Graph

42 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
20c33a05c8 feat(deeplink): register bikecontrol:// on iOS + Universal/App Links scaffolding
- iOS: add the bikecontrol custom URL scheme to CFBundleURLTypes (it was only
  registered on Android), so bikecontrol:// opens the app on iOS too.
- iOS: add the associated-domains entitlement (applinks:bikecontrol.app) for
  Universal Links.
- Android: add a verified App Links intent-filter for
  https://bikecontrol.app/app/... (autoVerify) alongside the bikecontrol://
  scheme.

Universal/App Links additionally require the website AASA + assetlinks.json
(separate repo), which need the Apple Team ID and the Play App Signing SHA-256.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 11:28:52 +02:00
Jonas Bark
68ab312c24 fix(ios): drop invalid 'picture-in-picture' UIBackgroundMode
App Store upload rejected the build (altool 90112): 'picture-in-picture' is
not a valid UIBackgroundModes value. The PiP gear overlay runs off the
existing 'audio' background mode, so just remove the bogus entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 23:41:39 +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
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
aba3c43227 fix(ios): render PiP frames — IOSurface-backed pixel buffers + DisplayImmediately
AVSampleBufferDisplayLayer only presents IOSurface-backed CVPixelBuffers; the
pool omitted kCVPixelBufferIOSurfacePropertiesKey, so frames were accepted
(status=.rendering, no error) but never rendered — the PiP window stayed black.
Add IOSurface backing and mark each sample buffer DisplayImmediately (no control
timebase, live HUD feed). Also wires the PiP Swift files into the Runner /
TrainerActivity Xcode targets (GearSnapshot in both; GearSnapshot+LiveActivity
in the extension only so Runner needs no ActivityKit).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 18:19:46 +02:00
Jonas Bark
8993a4b71f fix(ios): run PiP render path on the main actor (ImageRenderer is @MainActor) 2026-06-24 18:19:46 +02:00
Jonas Bark
51fa998354 feat(ios): wire bike_control/pip_ios method channel 2026-06-24 18:19:46 +02:00
Jonas Bark
4a6495f8c8 fix(ios): check pixel buffer pool creation; document main-actor pump invariant 2026-06-24 18:19:46 +02:00
Jonas Bark
34595e72b0 feat(ios): add PipGearController and Picture in Picture background mode
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 18:19:46 +02:00
Jonas Bark
058dec1dac feat(ios): add DeviceCapabilities (Dynamic Island detection, PiP eligibility) 2026-06-24 18:19:46 +02:00
Jonas Bark
081f4a113d feat(6.2): iOS screen recording backend (ReplayKit broadcast extension) [extension target needs Xcode wiring]
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 17:52:22 +02:00
Jonas Bark
0ec9943c35 version++ 2026-06-02 22:22:38 +02:00
Jonas Bark
9648e5e604 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
b668350226 fix dynamic island 2026-05-11 14:13:19 +02:00
Jonas Bark
8bdca5f4a6 fix live activity 2026-05-09 16:00:31 +02:00
Jonas Bark
8f5c93899c ios: enable Live Activities and App Group for trainer overlay 2026-05-09 09:18:25 +02:00
Jonas Bark
e5c3e6f0ef update iOS SDK 2026-04-29 09:42:58 +02:00
jonasbark
6867670d10 Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-08 14:54:16 +01:00
Jonas Bark
843da21a18 add missing NSPhotoLibraryUsageDescription 2026-02-27 13:09:01 +01:00
Jonas Bark
e1a7aac3e4 sign in with google, apple 2026-02-16 16:26:22 +01:00
Jonas Bark
e25429ee32 enable audio button capture on iOS 2026-02-14 10:11:25 +01:00
Jonas Bark
75b503f75b implement functionality, refactoring 2025-12-18 11:33:14 +01:00
Jonas Bark
ae5503a6c6 notifications on iOS 2025-12-17 10:20:36 +01:00
Jonas Bark
b69d41ecb5 in app purchase implementation on macOS / iOS 2025-12-14 19:32:23 +01:00
Jonas Bark
5bf9c4df63 work on mDNS 2025-12-05 10:51:40 +01:00
Jonas Bark
81a108359e remove media key detection due to Apple restrictions 2025-11-25 19:26:39 +00:00
copilot-swe-agent[bot]
fd1b82ed8b Rename app from SwiftControl to BikeControl and update GitHub repo references
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-11-21 18:07:48 +00:00
Jonas Bark
b3a85b9b1f integrate media_key_detector package, add iOS implementation #1 2025-11-07 21:55:07 +01:00
Jonas Bark
c72cadce62 MyWhoosh Link implementation #1 2025-10-21 22:43:02 +02:00
Jonas Bark
58411e8b23 macos + ios icon changes 2025-10-17 09:19:21 +02:00
Jonas Bark
b939c36863 new icon, cleanup 2025-10-16 23:46:32 +02:00
Jonas Bark
5969e39cd0 rebuild 2025-10-09 12:52:28 +02: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
7b2a311799 make it work #6 2025-10-07 18:33:00 +02:00
Jonas Bark
a3883ab7dd try bluetooth_low_energy 2025-10-06 18:46:46 +02:00
Jonas Bark
872908a766 make connection work on iOS 2025-09-29 10:14:19 +02:00
Jonas Bark
734cde9152 Revert "remove iOS folder as Apple does not support the core functionality"
This reverts commit 6c69fbffba.
2025-09-29 09:54:43 +02:00
Jonas Bark
6c69fbffba remove iOS folder as Apple does not support the core functionality 2025-09-27 14:02:10 +02:00
Jonas Bark
a42f1c900d rename 2025-03-27 14:57:04 +01:00
Jonas Bark
793ed76100 initial commit 2025-03-26 15:41:06 +01:00