diff --git a/lib/bluetooth/devices/base_device.dart b/lib/bluetooth/devices/base_device.dart index d5e0fc3..7093f4f 100644 --- a/lib/bluetooth/devices/base_device.dart +++ b/lib/bluetooth/devices/base_device.dart @@ -39,6 +39,16 @@ abstract class BaseDevice { Future connect(); Future handleButtonsClicked(List? buttonsClicked) async { + try { + await _handleButtonsClickedInternal(buttonsClicked); + } catch (e, st) { + actionStreamInternal.add( + LogNotification('Error handling button clicks: $e\n$st'), + ); + } + } + + Future _handleButtonsClickedInternal(List? buttonsClicked) async { if (buttonsClicked == null) { // ignore, no changes } else if (buttonsClicked.isEmpty) { diff --git a/lib/bluetooth/devices/zwift/zwift_device.dart b/lib/bluetooth/devices/zwift/zwift_device.dart index b4c75f7..a18b9cc 100644 --- a/lib/bluetooth/devices/zwift/zwift_device.dart +++ b/lib/bluetooth/devices/zwift/zwift_device.dart @@ -4,6 +4,8 @@ import 'package:dartx/dartx.dart'; import 'package:flutter/foundation.dart'; import 'package:swift_control/bluetooth/devices/bluetooth_device.dart'; import 'package:swift_control/bluetooth/devices/zwift/constants.dart'; +import 'package:swift_control/bluetooth/devices/zwift/zwift_play.dart'; +import 'package:swift_control/bluetooth/devices/zwift/zwift_ride.dart'; import 'package:swift_control/bluetooth/messages/notification.dart'; import 'package:swift_control/main.dart'; import 'package:swift_control/utils/keymap/buttons.dart'; @@ -156,7 +158,8 @@ abstract class ZwiftDevice extends BluetoothDevice { @override Future performClick(List buttonsClicked) async { if (buttonsClicked.any(((e) => e.action == InGameAction.shiftDown || e.action == InGameAction.shiftUp)) && - settings.getVibrationEnabled()) { + settings.getVibrationEnabled() && + (this is ZwiftPlay || this is ZwiftRide)) { await _vibrate(); } return super.performClick(buttonsClicked); diff --git a/lib/pages/touch_area.dart b/lib/pages/touch_area.dart index c90233a..24ecfe9 100644 --- a/lib/pages/touch_area.dart +++ b/lib/pages/touch_area.dart @@ -10,7 +10,7 @@ import 'package:flutter/services.dart'; import 'package:image_picker/image_picker.dart'; import 'package:path_provider/path_provider.dart'; import 'package:swift_control/main.dart'; -import 'package:swift_control/utils/keymap/apps/my_whoosh.dart'; +import 'package:swift_control/utils/requirements/multi.dart'; import 'package:swift_control/widgets/button_widget.dart'; import 'package:swift_control/widgets/keymap_explanation.dart'; import 'package:swift_control/widgets/testbed.dart'; @@ -396,7 +396,8 @@ class KeypairExplanation extends StatelessWidget { else Icon(keyPair.icon), if (keyPair.inGameAction != null && - ((settings.getTrainerApp() is MyWhoosh && settings.getMyWhooshLinkEnabled()) || + ((whooshLink.isCompatible(settings.getLastTarget() ?? Target.thisDevice) && + settings.getMyWhooshLinkEnabled()) || (settings.getTrainerApp()?.supportsZwiftEmulation == true && settings.getZwiftEmulatorEnabled()))) _KeyWidget( label: [