Commit Graph

8 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
514c396e5d feat(diagnostics): call out an active VPN on its own line
A user on iOS reported "MyWhoosh sees BikeControl but won't pair". Their
bundle looked healthy end to end: the advertisement was on the right
interface, our own mDNS record came back on the discovery scan, local
network permission was fine, both TCP servers were listening. The only
trace of the actual cause was a "(virtual)" suffix on one of three
interface rows: utun4/10.2.0.2. Turning the VPN off fixed it.

That asymmetry is the norm, not a fluke. mDNS is multicast and is not
carried into the tunnel, so discovery keeps working; the unicast TCP
connection that follows is the part a full-tunnel VPN swallows. Every
other line in the block therefore reads green.

Give it a line of its own, prefixed "VPN", so support sees it at a
glance instead of decoding scores. Only interfaces that carry a routable
IPv4 count -- Apple platforms always keep several idle utun devices
around for Private Relay / Continuity / Wi-Fi Calling, and those have no
IPv4 at all, so they never reach the candidate list. Names are matched
case-insensitively and partly as substrings because Dart reports the
adapter FriendlyName on Windows ("NordLynx", "ProtonVPN TUN"), where
prefix matching would miss nearly every VPN. Mesh VPNs handing out
100.64/10 are named but marked usually harmless: they route their own
overlay and leave the LAN path alone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 11:04: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
7ab6c6959b style: sort diagnostics TXT entries alphabetically by key 2026-06-22 17:00:17 +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
0e38f0d819 feat: add DebugDiagnostics aggregator and text formatter 2026-06-22 10:30:24 +02:00