From 25bb34fed909615fd39b1423635582fa4d7af41f Mon Sep 17 00:00:00 2001 From: Jonas Bark Date: Mon, 27 Oct 2025 21:45:50 +0100 Subject: [PATCH] add trainer app selection during app start --- icon.png | Bin 0 -> 26686 bytes lib/bluetooth/connection.dart | 7 +- lib/main.dart | 1 + lib/pages/device.dart | 31 ++++-- lib/pages/requirements.dart | 148 +++++++++++++++----------- lib/utils/actions/base_actions.dart | 1 + lib/utils/keymap/apps/custom_app.dart | 2 +- lib/utils/keymap/keymap.dart | 2 +- lib/utils/keymap/manager.dart | 6 +- lib/utils/requirements/multi.dart | 128 ++++++++++++++-------- lib/utils/requirements/remote.dart | 44 ++++---- lib/utils/settings/settings.dart | 113 ++++++-------------- lib/widgets/beta_pill.dart | 5 +- pubspec.yaml | 1 + test/custom_profile_test.dart | 46 ++++---- 15 files changed, 287 insertions(+), 248 deletions(-) create mode 100644 icon.png diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..27a4345a42c366c8f4769dbceb1ab47fe157ddb9 GIT binary patch literal 26686 zcmV)DK*7I>P)d4_rN}!2E%0N0o~5iYmk%V6ZY}y`Xj1~$cpVKdCLA?9Ng;#wo-slW(a z!~X^SRFql(6s0H#mv@AwmKvie0LM|r!5@0_d}Y(s*vLj(yLof013bmnL_Ki*vPDO) zUozu{TK~)wkAKCpPWqvni2)rgej%=@Uw|xoLB-}PgWd)|?ohIf_qGyCp&+8Q1& zt2WNYO`HlF=H_A+*u=(}XQ4+da%BT#W3z~ZbxK)dvX?JVBOtisYuW{Uu$f4sf&jP) z0y#b-#+qk0&W%QFs8QyycJroK%Z4(y*`?dtY@7x-bkLP&eQo4giwZyJLYAQceKnVi)Ma;MP2m!?|93jcubwO zh|^{@k0{?^W;tax&yQlBcb3XyCl|9;)|l0^XYq1^Bl=u*Fm@F{Z9`zw9?S_675@aB z6n8(@QeHFs4UMJdJnovJ^_c}$Hm3t7o`aEUu*YLF-5O7(jho`8%42THVo#-Y&ph!1 zufW=u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ZT3Fc#N=4h^N8gq9Z&PV9; z6qDv1zx|?Ypvg*F+zuAq1rTm&GkLeWcrIdxzPK*Dv{>jHKw6mOr8{(=jP5BKli)(QAc70z-7UCiE}nP3i|L{YF0kNY zZw+pYZ9%tF*J)!I&)6Lt%P}3>90YSRH^E#dbC>S(x`X2_)B8o9UNOQkFE2QpPa)lB>kUd15Fm+h3PQ4 zaMB%IRG}}l*p0O{xFLi|dAAjJFxDhEPS0U$Jelh+JpKOz00960Sk@9>00006Nkl e.companyId == ZwiftConstants.ZWIFT_MANUFACTURER_ID) ?.payload; - if (data != null) { + if (data != null && kDebugMode) { _actionStreams.add(LogNotification('Found unknown device with identifier: ${data.firstOrNull}')); } } @@ -155,7 +156,9 @@ class Connection { _addDevices(pads); }); - startMyWhooshServer(); + if (settings.getMyWhooshLinkEnabled() && settings.getTrainerApp() is MyWhoosh) { + startMyWhooshServer(); + } } Future startMyWhooshServer() { diff --git a/lib/main.dart b/lib/main.dart index 8432caae..bd634868 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -58,6 +58,7 @@ Future initializeActions(ConnectionType connectionType) async { ConnectionType.unknown => StubActions(), }; } + actionHandler.init(settings.getSupportedApp()); } class SwiftPlayApp extends StatelessWidget { diff --git a/lib/pages/device.dart b/lib/pages/device.dart index 3c4ca4b6..94ac92b3 100644 --- a/lib/pages/device.dart +++ b/lib/pages/device.dart @@ -8,7 +8,9 @@ import 'package:package_info_plus/package_info_plus.dart'; import 'package:swift_control/bluetooth/devices/link/link_device.dart'; import 'package:swift_control/main.dart'; import 'package:swift_control/utils/actions/desktop.dart'; +import 'package:swift_control/utils/keymap/apps/my_whoosh.dart'; import 'package:swift_control/utils/keymap/manager.dart'; +import 'package:swift_control/widgets/beta_pill.dart'; import 'package:swift_control/widgets/keymap_explanation.dart'; import 'package:swift_control/widgets/logviewer.dart'; import 'package:swift_control/widgets/scan.dart'; @@ -227,7 +229,7 @@ class _DevicePageState extends State with WidgetsBindingObserver { if (connection.remoteDevices.isNotEmpty || actionHandler is RemoteActions || - !whooshLink.isConnected.value) + settings.getTrainerApp() is MyWhoosh) Container( margin: const EdgeInsets.only(bottom: 8.0), width: double.infinity, @@ -250,7 +252,8 @@ class _DevicePageState extends State with WidgetsBindingObserver { (device) => device.showInformation(context), ), - if (!whooshLink.isConnected.value) LinkDevice('').showInformation(context), + if (settings.getTrainerApp() is MyWhoosh && !whooshLink.isConnected.value) + LinkDevice('').showInformation(context), if (actionHandler is RemoteActions) Row( @@ -305,7 +308,17 @@ class _DevicePageState extends State with WidgetsBindingObserver { controller: controller, dropdownMenuEntries: [ ..._getAllApps().map( - (app) => DropdownMenuEntry(value: app, label: app.name), + (app) => DropdownMenuEntry( + value: app, + label: app.name, + labelWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(app.name), + if (app is CustomApp) BetaPill(text: 'CUSTOM'), + ], + ), + ), ), DropdownMenuEntry( value: CustomApp(profileName: 'New'), @@ -314,7 +327,7 @@ class _DevicePageState extends State with WidgetsBindingObserver { leadingIcon: Icon(Icons.add), ), ], - label: Text('Select Keymap / app'), + label: Text('Select Keymap'), onSelected: (app) async { if (app == null) { return; @@ -323,14 +336,14 @@ class _DevicePageState extends State with WidgetsBindingObserver { if (profileName != null && profileName.isNotEmpty) { final customApp = CustomApp(profileName: profileName); actionHandler.init(customApp); - await settings.setApp(customApp); + await settings.setSupportedApp(customApp); controller.text = profileName; setState(() {}); } } else { controller.text = app.name ?? ''; actionHandler.supportedApp = app; - await settings.setApp(app); + await settings.setSupportedApp(app); setState(() {}); if (app is! CustomApp && !kIsWeb && @@ -371,7 +384,7 @@ class _DevicePageState extends State with WidgetsBindingObserver { controller.text = actionHandler.supportedApp?.name ?? ''; if (actionHandler.supportedApp is CustomApp) { - settings.setApp(actionHandler.supportedApp!); + settings.setSupportedApp(actionHandler.supportedApp!); } }, ), @@ -409,7 +422,7 @@ class _DevicePageState extends State with WidgetsBindingObserver { } List _getAllApps() { - final baseApps = SupportedApp.supportedApps.where((app) => app is! CustomApp).toList(); + final baseApp = settings.getTrainerApp(); final customProfiles = settings.getCustomAppProfiles(); final customApps = customProfiles.map((profile) { @@ -426,7 +439,7 @@ class _DevicePageState extends State with WidgetsBindingObserver { customApps.add(CustomApp()); } - return [...baseApps, ...customApps]; + return [if (baseApp != null) baseApp, ...customApps]; } } diff --git a/lib/pages/requirements.dart b/lib/pages/requirements.dart index 1f641cd1..be8829a8 100644 --- a/lib/pages/requirements.dart +++ b/lib/pages/requirements.dart @@ -64,66 +64,90 @@ class _RequirementsPageState extends State with WidgetsBinding backgroundColor: Theme.of(context).colorScheme.inversePrimary, actions: buildMenuButtons(), ), - body: _requirements.isEmpty - ? Center(child: CircularProgressIndicator()) - : Card( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: Stepper( - currentStep: _currentStep, - connectorColor: WidgetStateProperty.resolveWith( - (Set states) => Theme.of(context).colorScheme.primary, - ), - onStepContinue: _currentStep < _requirements.length - ? () { - setState(() { - _currentStep += 1; - }); - } - : null, - onStepTapped: (step) { - if (_requirements[step].status && _requirements[step] is! TargetRequirement) { - return; - } - final hasEarlierIncomplete = - _requirements.indexWhere((req) => !req.status) != -1 && - _requirements.indexWhere((req) => !req.status) < step; - if (hasEarlierIncomplete) { - return; - } - setState(() { - _currentStep = step; - }); - }, - controlsBuilder: (context, details) => Container(), - steps: _requirements - .mapIndexed( - (index, req) => Step( - title: Text(req.name, style: TextStyle(fontWeight: FontWeight.w600)), - subtitle: req.buildDescription() ?? (req.description != null ? Text(req.description!) : null), - content: Container( - padding: const EdgeInsets.only(top: 16.0), - alignment: Alignment.centerLeft, - child: - (index == _currentStep - ? req.build(context, () { - _reloadRequirements(); - }) - : null) ?? - ElevatedButton( - onPressed: req.status - ? null - : () => _callRequirement(req, context, () { - _reloadRequirements(); - }), - child: Text(req.name), - ), - ), - state: req.status ? StepState.complete : StepState.indexed, - ), - ) - .toList(), + body: Column( + spacing: 12, + children: [ + SizedBox(height: 12), + Row( + mainAxisSize: MainAxisSize.min, + spacing: 12, + children: [ + Image.asset('icon.png', width: 64, height: 64), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Welcome to SwiftControl!', style: Theme.of(context).textTheme.titleMedium), + Container( + constraints: BoxConstraints(maxWidth: MediaQuery.sizeOf(context).width - 140), + child: Text('Get started by completing the following steps:', style: TextStyle(fontSize: 14)), + ), + ], ), - ), + ], + ), + _requirements.isEmpty + ? Center(child: CircularProgressIndicator()) + : Card( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Stepper( + currentStep: _currentStep, + connectorColor: WidgetStateProperty.resolveWith( + (Set states) => Theme.of(context).colorScheme.primary, + ), + onStepContinue: _currentStep < _requirements.length + ? () { + setState(() { + _currentStep += 1; + }); + } + : null, + onStepTapped: (step) { + if (_requirements[step].status && _requirements[step] is! TargetRequirement) { + return; + } + final hasEarlierIncomplete = + _requirements.indexWhere((req) => !req.status) != -1 && + _requirements.indexWhere((req) => !req.status) < step; + if (hasEarlierIncomplete) { + return; + } + setState(() { + _currentStep = step; + }); + }, + controlsBuilder: (context, details) => Container(), + steps: _requirements + .mapIndexed( + (index, req) => Step( + title: Text(req.name, style: TextStyle(fontWeight: FontWeight.w600)), + subtitle: + req.buildDescription() ?? (req.description != null ? Text(req.description!) : null), + content: Container( + padding: const EdgeInsets.only(top: 16.0), + alignment: Alignment.centerLeft, + child: + (index == _currentStep + ? req.build(context, () { + _reloadRequirements(); + }) + : null) ?? + ElevatedButton( + onPressed: req.status + ? null + : () => _callRequirement(req, context, () { + _reloadRequirements(); + }), + child: Text(req.name), + ), + ), + state: req.status ? StepState.complete : StepState.indexed, + ), + ) + .toList(), + ), + ), + ], + ), ); } @@ -139,9 +163,6 @@ class _RequirementsPageState extends State with WidgetsBinding final unresolvedIndex = req.indexWhere((req) => !req.status); if (unresolvedIndex != -1) { _currentStep = unresolvedIndex; - if (mounted) { - setState(() {}); - } } else if (mounted) { String? currentPath; navigatorKey.currentState?.popUntil((route) { @@ -158,6 +179,9 @@ class _RequirementsPageState extends State with WidgetsBinding ); } } + if (mounted) { + setState(() {}); + } }); } } diff --git a/lib/utils/actions/base_actions.dart b/lib/utils/actions/base_actions.dart index 5e78b918..e4049234 100644 --- a/lib/utils/actions/base_actions.dart +++ b/lib/utils/actions/base_actions.dart @@ -25,6 +25,7 @@ abstract class BaseActions { void init(SupportedApp? supportedApp) { this.supportedApp = supportedApp; + print('Supported app: ${supportedApp?.name ?? "None"}'); if (supportedApp != null) { final allButtons = connection.devices.map((e) => e.availableButtons).flatten().distinct(); diff --git a/lib/utils/keymap/apps/custom_app.dart b/lib/utils/keymap/apps/custom_app.dart index a63e1263..204f15d6 100644 --- a/lib/utils/keymap/apps/custom_app.dart +++ b/lib/utils/keymap/apps/custom_app.dart @@ -8,7 +8,7 @@ import '../keymap.dart'; class CustomApp extends SupportedApp { final String profileName; - CustomApp({this.profileName = 'Custom'}) + CustomApp({this.profileName = 'Other'}) : super( name: profileName, packageName: "custom_$profileName", diff --git a/lib/utils/keymap/keymap.dart b/lib/utils/keymap/keymap.dart index a7d9b14b..7fd7abd9 100644 --- a/lib/utils/keymap/keymap.dart +++ b/lib/utils/keymap/keymap.dart @@ -49,7 +49,7 @@ class Keymap { _updateStream.add(null); if (actionHandler.supportedApp is CustomApp) { - settings.setApp(actionHandler.supportedApp!); + settings.setSupportedApp(actionHandler.supportedApp!); } } } diff --git a/lib/utils/keymap/manager.dart b/lib/utils/keymap/manager.dart index 190bed97..22563683 100644 --- a/lib/utils/keymap/manager.dart +++ b/lib/utils/keymap/manager.dart @@ -56,7 +56,7 @@ class KeymapManager { customApp.decodeKeymap(savedKeymap); } actionHandler.supportedApp = customApp; - await settings.setApp(customApp); + await settings.setSupportedApp(customApp); } }, ), @@ -236,7 +236,7 @@ class KeymapManager { customApp.decodeKeymap(savedKeymap); } actionHandler.supportedApp = customApp; - await settings.setApp(customApp); + await settings.setSupportedApp(customApp); return newName; } else { final customApp = CustomApp(profileName: newName); @@ -260,7 +260,7 @@ class KeymapManager { }); actionHandler.supportedApp = customApp; - await settings.setApp(customApp); + await settings.setSupportedApp(customApp); return newName; } } diff --git a/lib/utils/requirements/multi.dart b/lib/utils/requirements/multi.dart index cb0a572c..c6272c8a 100644 --- a/lib/utils/requirements/multi.dart +++ b/lib/utils/requirements/multi.dart @@ -4,6 +4,9 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:keypress_simulator/keypress_simulator.dart'; import 'package:swift_control/main.dart'; +import 'package:swift_control/utils/keymap/apps/custom_app.dart'; +import 'package:swift_control/utils/keymap/apps/my_whoosh.dart'; +import 'package:swift_control/utils/keymap/apps/supported_app.dart'; import 'package:swift_control/utils/requirements/platform.dart'; import 'package:swift_control/utils/requirements/remote.dart'; import 'package:swift_control/widgets/beta_pill.dart'; @@ -151,7 +154,7 @@ enum Target { class TargetRequirement extends PlatformRequirement { TargetRequirement() : super( - 'Select Target Device', + 'Select Trainer App & Target Device', description: 'Select your Target Device where you want to run your trainer app on', ) { status = false; @@ -162,65 +165,100 @@ class TargetRequirement extends PlatformRequirement { @override Future getStatus() async { - status = settings.getLastTarget() != null; + status = settings.getLastTarget() != null && settings.getTrainerApp() != null; } @override Widget? build(BuildContext context, VoidCallback onUpdate) { - return DropdownMenu( - dropdownMenuEntries: Target.values.map((target) { - return DropdownMenuEntry( - value: target, - label: target.title, - enabled: target.isCompatible, - trailingIcon: Icon(target.icon), - labelWidget: Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + return Column( + spacing: 8, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Select Trainer App', style: TextStyle(fontWeight: FontWeight.bold)), + DropdownMenu( + dropdownMenuEntries: SupportedApp.supportedApps.map((app) { + return DropdownMenuEntry( + value: app, + label: app.name, + ); + }).toList(), + hintText: 'Select Trainer app', + initialSelection: settings.getTrainerApp(), + onSelected: (selectedApp) async { + if (settings.getTrainerApp() is MyWhoosh && selectedApp is! MyWhoosh && whooshLink.isStarted.value) { + whooshLink.stopServer(); + } + settings.setTrainerApp(selectedApp!); + if (actionHandler.supportedApp == null || + (actionHandler.supportedApp is! CustomApp && selectedApp is! CustomApp)) { + actionHandler.init(selectedApp); + settings.setSupportedApp(selectedApp); + } + }, + ), + SizedBox(height: 8), + Text( + 'Select Target where ${settings.getTrainerApp()?.name ?? 'the Trainer app'} runs on', + style: TextStyle(fontWeight: FontWeight.bold), + ), + DropdownMenu( + dropdownMenuEntries: Target.values.map((target) { + return DropdownMenuEntry( + value: target, + label: target.title, + enabled: target.isCompatible, + trailingIcon: Icon(target.icon), + labelWidget: Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(target.title, style: TextStyle(fontWeight: FontWeight.bold)), - if (target.isBeta || (!Platform.isIOS && target == Target.iPad)) BetaPill(), + Row( + children: [ + Text(target.title, style: TextStyle(fontWeight: FontWeight.bold)), + if (target.isBeta || (!Platform.isIOS && target == Target.iPad)) BetaPill(), + ], + ), + Text( + target.isCompatible + ? target.description + : 'Due to iOS restrictions only controlling trainer apps on other devices is supported.', + style: TextStyle(fontSize: 12, color: Colors.grey), + ), ], ), - Text( - target.isCompatible - ? target.description - : 'Due to iOS restrictions only controlling trainer apps on other devices is supported.', - style: TextStyle(fontSize: 12, color: Colors.grey), - ), - ], - ), - ), - ); - }).toList(), - hintText: name, - initialSelection: settings.getLastTarget(), - onSelected: (target) async { - if (target != null) { - await settings.setLastTarget(target); - initializeActions(target.connectionType); - if (target.warning != null) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(target.warning!), - duration: Duration(seconds: 10), ), ); - } - onUpdate(); - } - }, + }).toList(), + hintText: name, + initialSelection: settings.getLastTarget(), + onSelected: (target) async { + if (target != null) { + await settings.setLastTarget(target); + initializeActions(target.connectionType); + if (target.warning != null) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(target.warning!), + duration: Duration(seconds: 10), + ), + ); + } + onUpdate(); + } + }, + ), + ], ); } @override Widget? buildDescription() { + final trainer = settings.getTrainerApp(); final target = settings.getLastTarget(); - if (target != null) { + if (target != null && trainer != null) { if (target.warning != null) { return Row( spacing: 8, @@ -235,7 +273,7 @@ class TargetRequirement extends PlatformRequirement { ], ); } else { - return Text(target.title); + return Text('${trainer.name} on ${target.title}'); } } else { return null; diff --git a/lib/utils/requirements/remote.dart b/lib/utils/requirements/remote.dart index 2fde2141..6f180e9f 100644 --- a/lib/utils/requirements/remote.dart +++ b/lib/utils/requirements/remote.dart @@ -7,6 +7,7 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:swift_control/main.dart'; import 'package:swift_control/pages/device.dart'; import 'package:swift_control/utils/actions/remote.dart'; +import 'package:swift_control/utils/keymap/apps/my_whoosh.dart'; import 'package:swift_control/utils/requirements/multi.dart'; import 'package:swift_control/utils/requirements/platform.dart'; import 'package:swift_control/widgets/small_progress_indicator.dart'; @@ -323,30 +324,31 @@ class _PairWidgetState extends State<_PairWidget> { if (_isAdvertising || _isLoading) SizedBox(height: 20, width: 20, child: SmallProgressIndicator()), ], ), - ElevatedButton( - onPressed: () async { - Navigator.push( - context, - MaterialPageRoute( - builder: (c) => DevicePage(), - settings: RouteSettings(name: '/device'), - ), - ); - }, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('Use MyWhoosh Link only'), - Text( - 'No pairing required, connect directly via MyWhoosh Link.', - style: TextStyle(fontSize: 10, color: Colors.black87), + if (settings.getTrainerApp() is MyWhoosh) + ElevatedButton( + onPressed: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: (c) => DevicePage(), + settings: RouteSettings(name: '/device'), ), - ], + ); + }, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Use MyWhoosh Link only'), + Text( + 'No pairing required, connect directly via MyWhoosh Link.', + style: TextStyle(fontSize: 10, color: Colors.black87), + ), + ], + ), ), ), - ), if (_isAdvertising) ...[ TextButton( onPressed: () { diff --git a/lib/utils/settings/settings.dart b/lib/utils/settings/settings.dart index cb7d3589..7f90708b 100644 --- a/lib/utils/settings/settings.dart +++ b/lib/utils/settings/settings.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'package:dartx/dartx.dart'; -import 'package:flutter/widgets.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:swift_control/utils/keymap/apps/supported_app.dart'; import 'package:swift_control/utils/requirements/multi.dart'; @@ -24,47 +23,8 @@ class Settings { } try { - // Get screen size for migrations - Size? screenSize; - try { - final view = WidgetsBinding.instance.platformDispatcher.views.first; - screenSize = view.physicalSize / view.devicePixelRatio; - } catch (e) { - screenSize = null; - } - - // Handle migration from old "customapp" key to new "customapp_Custom" key - if (prefs.containsKey('customapp') && !prefs.containsKey('customapp_Custom')) { - final oldCustomApp = prefs.getStringList('customapp'); - if (oldCustomApp != null) { - // Migrate pixel-based to percentage-based if screen size available - if (screenSize != null) { - final migratedData = await _migrateToPercentageBased(oldCustomApp, screenSize); - await prefs.setStringList('customapp_Custom', migratedData); - } else { - await prefs.setStringList('customapp_Custom', oldCustomApp); - } - await prefs.remove('customapp'); - } - } - - final appName = prefs.getString('app'); - if (appName == null) { - return; - } - - // Check if it's a custom app with a profile name - if (appName.startsWith('Custom') || prefs.containsKey('customapp_$appName')) { - final customApp = CustomApp(profileName: appName); - final appSetting = prefs.getStringList('customapp_$appName'); - if (appSetting != null) { - customApp.decodeKeymap(appSetting); - } - actionHandler.init(customApp); - } else { - final app = SupportedApp.supportedApps.firstOrNullWhere((e) => e.name == appName); - actionHandler.init(app); - } + final app = getSupportedApp(); + actionHandler.init(app); } catch (e) { // couldn't decode, reset await prefs.clear(); @@ -77,13 +37,44 @@ class Settings { actionHandler.init(null); } - Future setApp(SupportedApp app) async { + void setTrainerApp(SupportedApp app) { + prefs.setString('trainer_app', app.name); + } + + SupportedApp? getTrainerApp() { + final appName = prefs.getString('trainer_app'); + if (appName == null) { + return null; + } + return SupportedApp.supportedApps.firstOrNullWhere((e) => e.name == appName); + } + + Future setSupportedApp(SupportedApp app) async { if (app is CustomApp) { await prefs.setStringList('customapp_${app.profileName}', app.encodeKeymap()); } await prefs.setString('app', app.name); } + SupportedApp? getSupportedApp() { + final appName = prefs.getString('app'); + if (appName == null) { + return null; + } + + // Check if it's a custom app with a profile name + if (appName.startsWith('Custom') || prefs.containsKey('customapp_$appName')) { + final customApp = CustomApp(profileName: appName); + final appSetting = prefs.getStringList('customapp_$appName'); + if (appSetting != null) { + customApp.decodeKeymap(appSetting); + } + return customApp; + } else { + return SupportedApp.supportedApps.firstOrNullWhere((e) => e.name == appName); + } + } + List getCustomAppProfiles() { // Get all keys starting with 'customapp_' final keys = prefs.getKeys().where((key) => key.startsWith('customapp_')).toList(); @@ -167,42 +158,6 @@ class Settings { await prefs.setBool('vibration_enabled', enabled); } - Future> _migrateToPercentageBased(List keymapData, Size screenSize) async { - final migratedData = []; - - final needMigrations = keymapData.associateWith((encodedKeyPair) { - final decoded = jsonDecode(encodedKeyPair); - final touchPosData = decoded['touchPosition']; - - // Convert pixel-based to percentage-based - final x = (touchPosData['x'] as num).toDouble(); - final y = (touchPosData['y'] as num).toDouble(); - return x > 100.0 || y > 100.0; - }); - - for (final entry in needMigrations.entries) { - if (entry.value) { - final decoded = jsonDecode(entry.key); - final touchPosData = decoded['touchPosition']; - - // Convert pixel-based to percentage-based - final x = (touchPosData['x'] as num).toDouble(); - final y = (touchPosData['y'] as num).toDouble(); - final newX = (x / screenSize.width).clamp(0.0, 1.0) * 100.0; - final newY = (y / screenSize.height).clamp(0.0, 1.0) * 100.0; - - // Update the JSON structure - decoded['touchPosition'] = {'x': newX, 'y': newY}; - - migratedData.add(jsonEncode(decoded)); - } else { - migratedData.add(entry.key); - } - } - - return migratedData; - } - bool getMyWhooshLinkEnabled() { return prefs.getBool('mywhoosh_link_enabled') ?? true; } diff --git a/lib/widgets/beta_pill.dart b/lib/widgets/beta_pill.dart index e7249620..46e16495 100644 --- a/lib/widgets/beta_pill.dart +++ b/lib/widgets/beta_pill.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; class BetaPill extends StatelessWidget { - const BetaPill({super.key}); + final String text; + const BetaPill({super.key, this.text = 'BETA'}); @override Widget build(BuildContext context) { @@ -14,7 +15,7 @@ class BetaPill extends StatelessWidget { borderRadius: BorderRadius.circular(4), ), child: Text( - 'BETA', + text, style: TextStyle( color: Colors.white, fontSize: 10, diff --git a/pubspec.yaml b/pubspec.yaml index 2e3c4b57..3b7e6ff2 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -69,6 +69,7 @@ flutter: - INSTRUCTIONS_WINDOWS.md - INSTRUCTIONS_MACOS.md - shorebird.yaml + - icon.png msix_config: display_name: SwiftControl diff --git a/test/custom_profile_test.dart b/test/custom_profile_test.dart index 7b15a081..b9071d4c 100644 --- a/test/custom_profile_test.dart +++ b/test/custom_profile_test.dart @@ -28,8 +28,8 @@ void main() { test('Should save and retrieve custom profile', () async { final customApp = CustomApp(profileName: 'Race'); - await settings.setApp(customApp); - + await settings.setSupportedApp(customApp); + final profiles = settings.getCustomAppProfiles(); expect(profiles.contains('Race'), true); }); @@ -38,11 +38,11 @@ void main() { final workout = CustomApp(profileName: 'Workout'); final race = CustomApp(profileName: 'Race'); final event = CustomApp(profileName: 'Event'); - - await settings.setApp(workout); - await settings.setApp(race); - await settings.setApp(event); - + + await settings.setSupportedApp(workout); + await settings.setSupportedApp(race); + await settings.setSupportedApp(event); + final profiles = settings.getCustomAppProfiles(); expect(profiles.contains('Workout'), true); expect(profiles.contains('Race'), true); @@ -52,10 +52,10 @@ void main() { test('Should duplicate custom profile', () async { final original = CustomApp(profileName: 'Original'); - await settings.setApp(original); - + await settings.setSupportedApp(original); + await settings.duplicateCustomAppProfile('Original', 'Copy'); - + final profiles = settings.getCustomAppProfiles(); expect(profiles.contains('Original'), true); expect(profiles.contains('Copy'), true); @@ -64,13 +64,13 @@ void main() { test('Should delete custom profile', () async { final customApp = CustomApp(profileName: 'ToDelete'); - await settings.setApp(customApp); - + await settings.setSupportedApp(customApp); + var profiles = settings.getCustomAppProfiles(); expect(profiles.contains('ToDelete'), true); - + await settings.deleteCustomAppProfile('ToDelete'); - + profiles = settings.getCustomAppProfiles(); expect(profiles.contains('ToDelete'), false); }); @@ -81,10 +81,10 @@ void main() { 'customapp': ['test_data'], 'app': 'Custom', }); - + final newSettings = Settings(); await newSettings.init(); - + // Check that migration happened expect(newSettings.prefs.containsKey('customapp'), false); expect(newSettings.prefs.containsKey('customapp_Custom'), true); @@ -96,10 +96,10 @@ void main() { 'customapp_Custom': ['new_data'], 'app': 'Custom', }); - + final newSettings = Settings(); await newSettings.init(); - + // Old key should still exist because new key already existed expect(newSettings.getCustomAppKeymap('customapp'), null); final customKeymap = newSettings.getCustomAppKeymap('Custom'); @@ -108,8 +108,8 @@ void main() { test('Should export custom profile as JSON', () async { final customApp = CustomApp(profileName: 'TestProfile'); - await settings.setApp(customApp); - + await settings.setSupportedApp(customApp); + final jsonData = settings.exportCustomAppProfile('TestProfile'); expect(jsonData, isNotNull); expect(jsonData, contains('version')); @@ -120,12 +120,12 @@ void main() { test('Should import custom profile from JSON', () async { // First export a profile final customApp = CustomApp(profileName: 'ExportTest'); - await settings.setApp(customApp); + await settings.setSupportedApp(customApp); final jsonData = settings.exportCustomAppProfile('ExportTest'); - + // Import with a new name final success = await settings.importCustomAppProfile(jsonData!, newProfileName: 'ImportTest'); - + expect(success, true); final profiles = settings.getCustomAppProfiles(); expect(profiles.contains('ImportTest'), true);