mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-02-18 00:17:40 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
586b17c2d2 | ||
|
|
4909a1a47f | ||
|
|
99e603413c | ||
|
|
875f5cb656 | ||
|
|
7ad65ba5dc | ||
|
|
7e969b1a94 | ||
|
|
5689980c87 | ||
|
|
b14a6451ed | ||
|
|
7a52828bd1 | ||
|
|
6926f5d3d5 | ||
|
|
cb6283364a | ||
|
|
1e220799be |
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
@@ -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
|
||||
|
||||
3
.github/workflows/patch.yml
vendored
3
.github/workflows/patch.yml
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
[](https://www.youtube.com/watch?v=rK6Zthcl2UU)
|
||||
|
||||
|
||||
## Download
|
||||
|
||||
@@ -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}');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
2
prop
Submodule prop updated: 9e27035237...2283bd5273
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user