From ac550fad5ba9ce099d4d37fe2c8b98e4dc4933e3 Mon Sep 17 00:00:00 2001 From: Jonas Bark Date: Mon, 3 Nov 2025 18:58:41 +0100 Subject: [PATCH] do not offer MyWhoosh Link when not compatible --- .github/workflows/patch.yml | 1 + lib/bluetooth/devices/link/link.dart | 8 ++++++++ lib/bluetooth/devices/link/link_device.dart | 19 ++++++++++++++++--- lib/pages/device.dart | 6 ++++-- lib/utils/requirements/remote.dart | 1 + 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml index bfb5459..6f7906f 100644 --- a/.github/workflows/patch.yml +++ b/.github/workflows/patch.yml @@ -75,6 +75,7 @@ jobs: echo "${{ secrets.KEYSTORE_PROPERTIES }}" > android/keystore.properties; - name: 🚀 Shorebird Patch macOS + if: false # patch doesn't work: https://github.com/jonasbark/swiftcontrol/issues/143 uses: shorebirdtech/shorebird-patch@v1 with: platform: macos diff --git a/lib/bluetooth/devices/link/link.dart b/lib/bluetooth/devices/link/link.dart index 80ca099..a05a3a1 100644 --- a/lib/bluetooth/devices/link/link.dart +++ b/lib/bluetooth/devices/link/link.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:swift_control/utils/keymap/buttons.dart'; +import 'package:swift_control/utils/requirements/multi.dart'; class WhooshLink { Socket? _socket; @@ -138,4 +139,11 @@ class WhooshLink { return 'No action available for button: $action'; } } + + bool isCompatible(Target target) { + return switch (target) { + Target.thisDevice => Platform.isAndroid || Platform.isWindows, + _ => true, + }; + } } diff --git a/lib/bluetooth/devices/link/link_device.dart b/lib/bluetooth/devices/link/link_device.dart index 0b7dc37..6a06280 100644 --- a/lib/bluetooth/devices/link/link_device.dart +++ b/lib/bluetooth/devices/link/link_device.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:swift_control/bluetooth/devices/base_device.dart'; import 'package:swift_control/main.dart'; +import 'package:swift_control/utils/actions/remote.dart'; import 'package:swift_control/widgets/small_progress_indicator.dart'; import 'package:url_launcher/url_launcher_string.dart'; @@ -28,6 +29,9 @@ class LinkDevice extends BaseDevice { builder: (context, isConnected, _) { return StatefulBuilder( builder: (context, setState) { + final myWhooshExplanation = actionHandler is RemoteActions + ? 'MyWhoosh Link allows you to do some additional features such as Emotes and turn directions.' + : 'MyWhoosh Link is optional, but allows you to do some additional features such as Emotes and turn directions.'; return Row( children: [ Expanded( @@ -49,10 +53,19 @@ class LinkDevice extends BaseDevice { spacing: 12, children: [ if (!settings.getMyWhooshLinkEnabled()) - Text('Disabled') + Expanded( + child: Text( + myWhooshExplanation, + style: TextStyle(fontSize: 12), + ), + ) else ...[ - Text( - isConnected ? "Connected" : "Connecting to MyWhoosh...", + Expanded( + child: Text( + isConnected ? "Connected" : "Connecting to MyWhoosh...\n$myWhooshExplanation", + + style: TextStyle(fontSize: 12), + ), ), if (!isConnected) SmallProgressIndicator(), ], diff --git a/lib/pages/device.dart b/lib/pages/device.dart index e587276..6927201 100644 --- a/lib/pages/device.dart +++ b/lib/pages/device.dart @@ -334,7 +334,7 @@ class _DevicePageState extends State with WidgetsBindingObserver { if (connection.remoteDevices.isNotEmpty || actionHandler is RemoteActions || - settings.getTrainerApp() is MyWhoosh || + whooshLink.isCompatible(settings.getLastTarget()!) || actionHandler.supportedApp?.supportsZwiftEmulation == true) Container( margin: const EdgeInsets.only(bottom: 8.0), @@ -358,7 +358,9 @@ class _DevicePageState extends State with WidgetsBindingObserver { (device) => device.showInformation(context), ), - if (settings.getTrainerApp() is MyWhoosh && !whooshLink.isConnected.value) + if (settings.getTrainerApp() is MyWhoosh && + !whooshLink.isConnected.value && + whooshLink.isCompatible(settings.getLastTarget()!)) LinkDevice('').showInformation(context), if (settings.getTrainerApp()?.supportsZwiftEmulation == true) ZwiftRequirement().build(context, () { diff --git a/lib/utils/requirements/remote.dart b/lib/utils/requirements/remote.dart index 6fed456..89c93d6 100644 --- a/lib/utils/requirements/remote.dart +++ b/lib/utils/requirements/remote.dart @@ -309,6 +309,7 @@ class _PairWidgetState extends State<_PairWidget> { if (settings.getTrainerApp() is MyWhoosh) ElevatedButton( onPressed: () async { + settings.setMyWhooshLinkEnabled(true); Navigator.push( context, MaterialPageRoute(