Compare commits

...

12 Commits

Author SHA1 Message Date
Jonas Bark
586b17c2d2 version++ 2026-01-29 16:22:46 +01:00
Jonas Bark
4909a1a47f fix issue when duplicating keymap 2026-01-29 16:22:32 +01:00
Jonas Bark
99e603413c improve click V2 unlock logic 2026-01-29 14:57:55 +01:00
Jonas Bark
875f5cb656 fix issue #282 2026-01-29 14:56:47 +01:00
Jonas Bark
7ad65ba5dc version++ 2026-01-28 15:20:11 +01:00
Jonas Bark
7e969b1a94 Merge remote-tracking branch 'origin/main' 2026-01-28 15:19:31 +01:00
Jonas Bark
5689980c87 potentially fix #276 2026-01-28 15:19:24 +01:00
jonasbark
b14a6451ed Update README with YouTube video and clean up links
Added a YouTube video link and removed an outdated asset link.
2026-01-28 15:04:01 +01:00
Jonas Bark
7a52828bd1 fix build for Windows 2026-01-28 12:46:12 +01:00
Jonas Bark
6926f5d3d5 fix build for Windows 2026-01-28 12:36:34 +01:00
Jonas Bark
cb6283364a fix build for Windows 2026-01-28 12:36:06 +01:00
Jonas Bark
1e220799be fix build for Windows 2026-01-28 12:34:13 +01:00
9 changed files with 48 additions and 26 deletions

View File

@@ -240,6 +240,9 @@ jobs:
#1 Checkout Repository
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: Extract version from pubspec.yaml (Windows)
shell: pwsh
@@ -257,7 +260,7 @@ jobs:
- name: Set Up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'beta'
channel: 'stable'
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Generate translation files

View File

@@ -162,6 +162,9 @@ jobs:
#1 Checkout Repository
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: 🐦 Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1

View File

@@ -11,10 +11,7 @@ With BikeControl you can **control your favorite trainer app** using your Zwift
- control music on your device
- more? If you can do it via keyboard, mouse, or touch, you can do it with BikeControl
https://github.com/user-attachments/assets/1f81b674-1628-4763-ad66-5f3ed7a3f159
[![Youtube Video](https://github.com/user-attachments/assets/1bd49f4c-e920-4ad1-ba68-99c7bc9bd1ab)](https://www.youtube.com/watch?v=rK6Zthcl2UU)
## Download

View File

@@ -83,18 +83,18 @@ class FtmsMdnsEmulator extends TrainerConnection {
final bytes = status.writeToBuffer();
clickEmulator.write(bytes);
clickEmulator.writeNotification(bytes);
}
if (isKeyUp) {
clickEmulator.write(
Uint8List.fromList([Opcode.CONTROLLER_NOTIFICATION.value, 0x08, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F]),
clickEmulator.writeNotification(
Uint8List.fromList([0x08, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F]),
);
}
if (kDebugMode) {
print('Sent action $isKeyUp vs $isKeyDown ${keyPair.inGameAction!.title} to Zwift Emulator');
print('Sent action up $isKeyUp vs down $isKeyDown ${keyPair.inGameAction!.title} to Zwift Emulator');
}
return Success('Sent action: ${keyPair.inGameAction!.title}');
return Success('Sent action ${isKeyDown ? 'down' : ''} ${isKeyUp ? 'up' : ''}: ${keyPair.inGameAction!.title}');
}
}

View File

@@ -56,6 +56,13 @@ class ZwiftClickV2 extends ZwiftRide {
return lastUnlock > DateTime.now().subtract(const Duration(days: 1));
}
@override
Future<void> setupHandshake() async {
if (isUnlocked) {
super.setupHandshake();
}
}
@override
Future<void> handleServices(List<BleService> services) async {
emulator.handleServices(services);

View File

@@ -314,19 +314,27 @@ class RevenueCatService {
/// Increment the daily command count
Future<void> incrementCommandCount() async {
final today = DateTime.now().toIso8601String().split('T')[0];
final lastDate = await _prefs.read(key: _lastCommandDateKey);
try {
final today = DateTime.now().toIso8601String().split('T')[0];
final lastDate = await _prefs.read(key: _lastCommandDateKey);
if (lastDate != today) {
// Reset counter for new day
_lastCommandDate = today;
_dailyCommandCount = 1;
await _prefs.write(key: _lastCommandDateKey, value: today);
await _prefs.write(key: _dailyCommandCountKey, value: '1');
} else {
if (lastDate != today) {
// Reset counter for new day
_lastCommandDate = today;
_dailyCommandCount = 1;
await _prefs.write(key: _lastCommandDateKey, value: today);
await _prefs.write(key: _dailyCommandCountKey, value: '1');
} else {
final count = _dailyCommandCount ?? 0;
_dailyCommandCount = count + 1;
await _prefs.write(key: _dailyCommandCountKey, value: _dailyCommandCount.toString());
}
} catch (e, s) {
final count = _dailyCommandCount ?? 0;
_dailyCommandCount = count + 1;
await _prefs.write(key: _dailyCommandCountKey, value: _dailyCommandCount.toString());
// e.g. https://github.com/jonasbark/swiftcontrol/issues/279
debugPrint('Error incrementing command count: $e');
recordError(e, s, context: 'Incrementing command count');
}
}

View File

@@ -247,9 +247,11 @@ class KeymapManager {
} else {
final customApp = CustomApp(profileName: newName);
final connectedDevice = core.connection.devices.firstOrNull;
final connectedDeviceButtons = IterableFlatMap(
core.connection.controllerDevices,
).flatMap((e) => e.availableButtons).toSet();
core.actionHandler.supportedApp!.keymap.keyPairs.forEachIndexed((pair, index) {
pair.buttons.filter((button) => connectedDevice?.availableButtons.contains(button) == true).forEachIndexed((
pair.buttons.filter((button) => connectedDeviceButtons.contains(button) == true).forEachIndexed((
button,
indexB,
) {
@@ -288,9 +290,11 @@ class KeymapManager {
} else {
final customApp = CustomApp(profileName: newName);
final connectedDevice = core.connection.devices.firstOrNull;
final connectedDeviceButtons = IterableFlatMap(
core.connection.controllerDevices,
).flatMap((e) => e.availableButtons).toSet();
core.actionHandler.supportedApp!.keymap.keyPairs.forEachIndexed((pair, index) {
pair.buttons.filter((button) => connectedDevice?.availableButtons.contains(button) == true).forEachIndexed((
pair.buttons.filter((button) => connectedDeviceButtons.contains(button) == true).forEachIndexed((
button,
indexB,
) {

2
prop

Submodule prop updated: 9e27035237...2283bd5273

View File

@@ -1,7 +1,7 @@
name: bike_control
description: "BikeControl - Control your virtual riding"
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 4.6.0+88
version: 4.6.2+91
environment:
sdk: ^3.9.0