Commit Graph

65 Commits

Author SHA1 Message Date
Jonas Bark
20788e46b6 fix(requirements): stop the permission sheet opening for a granted permission
Toggling the "Direct connection" card could wedge: the sheet opened for a
permission that was already granted, and then sat there, because PermissionList
only re-probes on app resume.

ConnectionMethod probed one requirement list, awaited, then re-read
`widget.requirements` on the far side of the gap:

    Future.wait(widget.requirements.map((e) => e.getStatus())).then((_) async {
      final notDone = widget.requirements.filter((e) => !e.status).toList();

The tiles build that list inside `build()`, so any rebuild in that window hands
back fresh objects whose mutable `status` is still false — and these tiles
rebuild on every isConnected/isStarted tick, plus onChange's own setState. The
probe result was read off objects that were never probed.

Capture the list once per operation instead. This was pre-existing and not
specific to Local Network: di2_ble_tile and openbikecontrol_ble_tile pass
getRemoteControlRequirements() the same way, so they had the same latent race.

Also hoist the requirement lists out of build() into State fields across the
five tiles, so a probed `status` is not discarded every frame.

Separately: LocalNetworkRequirement was only wired into the network tiles, so
onboarding, app start and scanning never checked it at all — every one of those
reads getScanRequirements(). Add it there for iOS and macOS. The list is
filtered to unsatisfied requirements, so it surfaces only on an actual denial.

Note for macOS: keyboard-control-only users will now see a Local Network prompt
they do not need. Accepted deliberately in favour of one list over a
platform-split.

The regression test drives the real race — gate the probe, force a rebuild
mid-flight, release — and fails with "Found 1 widget with type PermissionList"
without the capture fix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 08:55:04 +02:00
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@gmx.de
599e2e644d fix: let trainer apps on the network find BikeControl again
Retires the Windows IPv6 workaround instructions along with it — they no
longer apply.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 14:33:34 +02:00
Jonas Bark
7cfbdc0ee7 fix: preserve Zwift tile notification behavior in extracted connection tiles 2026-08-09 22:16:23 +02:00
Jonas Bark
529f210b6e refactor: extract connection-method tile lists for reuse by onboarding 2026-08-09 22:16:23 +02:00
Jonas Bark
c682be43bc fix(ui): guard async setState/context against disposed widgets
Symbolicating a Rouvy user's 6.1 crashes (Shorebird patch build_id
4b7026f5fbf44e52452ba9e557c2c5a0) surfaced two "Null check operator used
on a null value" crashes: async UI callbacks running after their widget
was disposed (the user rapidly re-toggled the Zwift BLE option as
advertising kept failing).

- ZwiftTile.onChange: setState() ran after `await stopAllBleConnections`
  on an unmounted state -> guard with `mounted`.
- ConnectionMethod: openPermissionSheet(context, ...) and setState() ran
  after `await Future.wait(requirements)` on a defunct context -> guard
  both async gaps with `context.mounted` (matching the existing guard at
  line 315).

The underlying trigger (Zwift emulator "Data too large" advertise failure
on Rouvy) is tracked separately for the 6.2 branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 08:16:08 +02:00
Jonas Bark
218a7e2e98 zwift adjustments 2026-05-21 22:01:14 +02:00
Jonas Bark
51f2455166 rouvy mode 2026-05-21 20:34:51 +02:00
Jonas Bark
353a1f98ba MyWhoosh Windows workaround 2026-05-13 13:24:50 +02:00
Jonas Bark
351b09e0ef feat: add Di2BleTile connection-settings widget 2026-04-28 19:12:38 +02:00
Jonas Bark
2071719fbd UI adjustments 2026-04-26 09:44:56 +02:00
Jonas Bark
642fc754a1 UI adjustments, BLE advertisement fix 2026-04-26 09:14:00 +02:00
Jonas Bark
60f4ef938b UI + logic adjustments 2026-04-21 11:46:58 +02:00
Jonas Bark
374499e669 resolve https://github.com/OpenBikeControl/bikecontrol/issues/338 2026-04-12 11:13:08 +02:00
Jonas Bark
83c7532bfb resolve https://github.com/OpenBikeControl/bikecontrol/issues/341 2026-04-12 09:20:44 +02:00
Jonas Bark
9c17ea0fc0 wording adjustments 2026-04-07 08:26:51 +02:00
Jonas Bark
00d546e75b connection method adjustments 2026-03-25 13:49:49 +01:00
Jonas Bark
5ed2bce59b revise connection methods 2026-03-25 09:27:37 +01:00
Jonas Bark
6435be973f new ui #19 2026-03-12 10:11:17 +01:00
Jonas Bark
922c785df1 new ui #4 2026-03-10 19:04:51 +01:00
Jonas Bark
a215a35e0c mark some connection methods as recommended 2026-03-04 14:22:38 +01:00
Jonas Bark
98e7eaf51a work on issue #310 2026-02-23 15:18:17 +01:00
copilot-swe-agent[bot]
1a19d740e7 Add target app name setting to send key presses to a specific app on macOS
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-23 08:26:10 +00:00
Jonas Bark
42472f59db cleanup toast handling 2026-02-08 10:01:54 +01:00
Jonas Bark
8997b54a9a group buttons by device, add new unlock mechanism 2026-01-23 15:27:32 +01:00
Jonas Bark
1a56ea1047 list supported actions of connection method 2026-01-11 13:00:43 +01:00
Jonas Bark
42a83e8af5 performance & ui fixes 2026-01-07 10:19:21 +01:00
Jonas Bark
ed1ce0da1c instructions UI change 2026-01-02 15:03:46 +01:00
Jonas Bark
a525df2139 instructions for local connection method 2026-01-02 14:03:08 +01:00
Jonas Bark
c57c51d2e0 onboarding UI 2026-01-01 13:44:45 +01:00
Jonas Bark
05d1588a76 press longer for the simulator, enable long press for devices not supporting long press (e.g. Shimano Di2) 2025-12-19 11:33:13 +01:00
Jonas Bark
57ce58448e translations and ux changes 2025-12-17 11:39:39 +01:00
Jonas Bark
3b76ad22ec error reporting when starting connection method 2025-12-15 13:13:57 +01:00
Jonas Bark
93e3e50edb prioritize OBP connection methods when available 2025-12-15 12:48:19 +01:00
Jonas Bark
5a67f2ee76 remove remains of swift_control 2025-12-14 16:22:07 +01:00
Jonas Bark
fae08c0db5 button simulator adjustments 2025-12-11 09:20:02 +01:00
Jonas Bark
7b9b8de975 clarify mywhoosh link 2025-12-10 21:26:43 +01:00
Jonas Bark
3426b8a669 add more instructions, clarify mail support 2025-12-10 21:17:49 +01:00
Jonas Bark
cdd4a69716 control your trainer manually without requiring a controller - just like a Companion app 2025-12-10 18:57:08 +01:00
Jonas Bark
e723602ebd fix pairing permission issues 2025-12-07 11:03:21 +01:00
Jonas Bark
4a0b50c6be work on mDNS 2025-12-05 10:51:40 +01:00
Jonas Bark
55e437d1ef ui, fixes 2025-12-04 20:27:53 +00:00
Jonas Bark
727727f8fb ui, fixes 2025-12-04 19:32:02 +00:00
Jonas Bark
541e6f8a42 connection method badges 2025-12-04 14:00:39 +00:00
Jonas Bark
3d1380f72a ui adjustments 2025-12-01 22:58:29 +00:00
Jonas Bark
a9149a7499 translations 2025-12-01 15:46:02 +00:00
Jonas Bark
61350e019a Merge remote-tracking branch 'origin/copilot/extract-translations-to-arb' into feature/openbikecontrol
# Conflicts:
#	lib/pages/trainer.dart
2025-12-01 15:35:54 +00:00
Jonas Bark
400379ff93 zwift keep alive 2025-12-01 15:34:50 +00:00
copilot-swe-agent[bot]
d88ae8e9ed Add i18n_extension.dart and fix import/export keys, update imports
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-01 14:48:45 +00:00
copilot-swe-agent[bot]
e28126870f Update remaining files to use localized strings
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-01 14:41:28 +00:00