From 49e45faec021f9dd536ce9cd6e893ba85446abbd Mon Sep 17 00:00:00 2001 From: Jonas Bark Date: Sun, 2 Nov 2025 10:50:44 +0100 Subject: [PATCH] fix SwiftControl Web --- .../devices/shimano/shimano_di2.dart | 2 +- lib/pages/device.dart | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/bluetooth/devices/shimano/shimano_di2.dart b/lib/bluetooth/devices/shimano/shimano_di2.dart index 7ed0404..9c43112 100644 --- a/lib/bluetooth/devices/shimano/shimano_di2.dart +++ b/lib/bluetooth/devices/shimano/shimano_di2.dart @@ -30,7 +30,7 @@ class ShimanoDi2 extends BluetoothDevice { } } - var _lastButtons = {}; + final _lastButtons = {}; @override Future processCharacteristic(String characteristic, Uint8List bytes) { diff --git a/lib/pages/device.dart b/lib/pages/device.dart index 7bcacd9..479e9d9 100644 --- a/lib/pages/device.dart +++ b/lib/pages/device.dart @@ -61,18 +61,20 @@ class _DevicePageState extends State with WidgetsBindingObserver { _checkAndShowChangelog(); }); - whooshLink.isStarted.addListener(() { - if (mounted) setState(() {}); - }); - - zwiftEmulator.isConnected.addListener(() { - if (mounted) setState(() {}); - }); - - if (settings.getZwiftEmulatorEnabled() && actionHandler.supportedApp?.supportsZwiftEmulation == true) { - zwiftEmulator.startAdvertising(() { + if (!kIsWeb) { + whooshLink.isStarted.addListener(() { if (mounted) setState(() {}); }); + + zwiftEmulator.isConnected.addListener(() { + if (mounted) setState(() {}); + }); + + if (settings.getZwiftEmulatorEnabled() && actionHandler.supportedApp?.supportsZwiftEmulation == true) { + zwiftEmulator.startAdvertising(() { + if (mounted) setState(() {}); + }); + } } if (actionHandler is RemoteActions && !kIsWeb && Platform.isIOS && (actionHandler as RemoteActions).isConnected) {