Commit Graph

63 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
7e4f67642d feat(connection): enableLocalControl helper for inline enabling
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRVXtrmcgtKKz46AVDyqQp
2026-07-02 08:51:41 +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
6e0861e556 Name the trainer app and show its transport in connection alerts
The "connected"/"disconnected" activity alerts fired when a trainer app
attaches to one of our emulators now name the app ("Connected to Zwift",
"Disconnected from Zwift") and tag the alert with the transport, so the
activity log shows a WiFi or Bluetooth icon depending on how the app is
connected instead of always Bluetooth.

- AlertNotification gains a connectionType field + a connection() factory
  that builds the localized, app-named message and tags the transport.
- All 6 emulator call sites (Zwift BLE, FTMS/Rouvy mDNS) route through it,
  passing their own type and core.settings.getTrainerApp()?.name.
- ConnectionMethodType.activityIcon maps network -> wifi, else -> bluetooth;
  overview threads connectionType through and uses it for the leading icon.
- Reuse existing connectedTo string; add disconnectedFrom (en/de/es/fr/it/pl).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 21:22:59 +02:00
Jonas Bark
9c43a07cb0 fix gear change buttons 2026-05-10 11:10:22 +02:00
Jonas Bark
8e37d1404d UI fix 2026-05-07 15:27:24 +02:00
Jonas Bark
f5b5d7f9d2 i18n: extract miscellaneous hardcoded strings across pages
Pulls 'Open connection settings' (×2 in customize.dart), 'No target
selected' / 'Stay' / 'Leave' / 'Show experimental' /
'Connection Settings' / 'this trainer app' fallback in
trainer_connection_settings.dart, 'Not Supported on Web' toast and
'Recommended' badge in connection_method.dart, and the workout share
text in workout_summary_dialog.dart into the ARB.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 13:32:57 +02:00
Jonas Bark
5df12f908d UI adjustments 2026-04-26 09:44:56 +02:00
Jonas Bark
c47667af94 UI adjustments, BLE advertisement fix 2026-04-26 09:14:00 +02:00
Jonas Bark
a3e43e8c8f connection method adjustments 2026-03-25 13:12:11 +01:00
Jonas Bark
8f3b090b3a UI adjustments 2026-03-25 11:28:03 +01:00
Jonas Bark
a34b2ac9bf revise connection methods 2026-03-25 09:27:37 +01:00
Jonas Bark
db7990d6c0 updated screenshots 2026-03-12 11:57:36 +01:00
Jonas Bark
1a9695872d new ui #16 2026-03-12 09:35:00 +01:00
Jonas Bark
76bc8f5175 new ui #14 2026-03-11 19:30:29 +01:00
Jonas Bark
c332fa7704 new ui #12 2026-03-11 17:35:26 +01:00
Jonas Bark
822f65e703 new ui #6 2026-03-11 11:36:33 +01:00
Jonas Bark
0e22de93db new ui #5 2026-03-10 21:02:41 +01:00
Jonas Bark
30037e1a83 new ui #4 2026-03-10 19:04:51 +01:00
Jonas Bark
ce36b8d8aa mark some connection methods as recommended 2026-03-04 14:22:38 +01:00
Jonas Bark
101830e33f additional fixes 2026-02-16 18:22:16 +01:00
Jonas Bark
6473b59ee5 cleanup toast handling 2026-02-08 10:01:54 +01:00
Jonas Bark
b3a9829910 add new remote keyboard connection method 2026-02-05 17:22:21 +01:00
Jonas Bark
aae6d22f00 show logs file path 2026-01-15 14:35:18 +01:00
Jonas Bark
b067d6eee9 UI fix 2026-01-12 18:43:10 +01:00
Jonas Bark
8ddcdd3bc8 list supported actions of connection method 2026-01-11 13:01:10 +01:00
Jonas Bark
32046c1721 list supported actions of connection method 2026-01-11 13:00:43 +01:00
Jonas Bark
e9433a80f2 performance & ui fixes 2026-01-07 10:19:21 +01:00
Jonas Bark
8544696276 instructions UI change 2026-01-02 15:03:46 +01:00
Jonas Bark
e1f27d2614 onboarding for new users 2025-12-31 16:16:37 +01:00
Jonas Bark
9564b37cfd onboarding for new users 2025-12-31 15:52:30 +01:00
Jonas Bark
f9e1c374a3 ui adjustments 2025-12-31 13:51:47 +01:00
Jonas Bark
233a78ae6d translations and ux changes 2025-12-17 11:39:39 +01:00
Jonas Bark
ae5503a6c6 notifications on iOS 2025-12-17 10:20:36 +01:00
Jonas Bark
2528342a7b remove remains of swift_control 2025-12-14 16:22:07 +01:00
Jonas Bark
7f5e5656d7 add more instructions, clarify mail support 2025-12-10 21:17:49 +01:00
Jonas Bark
fa43294b3f better web compatibility 2025-12-07 12:05:52 +01:00
Jonas Bark
38f4bceba0 fix pairing permission issues 2025-12-07 11:03:21 +01:00
Jonas Bark
e58721d0ee refactoring 2025-12-06 11:46:18 +01:00
Jonas Bark
02d21a01b8 ui adjustments, fixes 2025-12-06 10:02:56 +01:00
Jonas Bark
43507febf9 fix hid device functionality when accessibility service is active 2025-12-05 19:48:34 +01:00
Jonas Bark
09f3c5f0b8 cleanup, refactoring 2025-12-05 15:40:04 +01:00
Jonas Bark
cbe995ec52 cleanup, refactoring 2025-12-05 13:22:52 +01:00
Jonas Bark
5bf9c4df63 work on mDNS 2025-12-05 10:51:40 +01:00
Jonas Bark
de70c80ca7 ui, fixes 2025-12-04 20:00:01 +00:00
Jonas Bark
e521bd05f7 ui, fixes 2025-12-04 19:42:19 +00:00
Jonas Bark
58998bb61b ui, fixes 2025-12-04 19:32:02 +00:00
Jonas Bark
eea1e5007e connection method badges 2025-12-04 14:00:39 +00:00
Jonas Bark
7e08d3687b add openbikecontrol as app 2025-12-04 13:27:40 +00:00
Jonas Bark
4da2980805 ui adjustments 2025-12-04 12:58:31 +00:00