feat: redesign and lots of progress

This commit is contained in:
2026-04-26 22:43:22 +02:00
parent 16ac66471a
commit 82ea8125e1
24 changed files with 1095 additions and 1315 deletions

View File

@ -0,0 +1,44 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
const MethodChannel _settingsChannel = MethodChannel('abawo/settings');
Future<bool> openBluetoothSettings() async {
if (!Platform.isAndroid) {
return false;
}
try {
return await _settingsChannel.invokeMethod<bool>('openBluetoothSettings') ??
false;
} on PlatformException {
return false;
}
}
Future<void> showBluetoothPairingRecoveryDialog(BuildContext context) {
return showDialog<void>(
context: context,
builder: (context) => AlertDialog(
title: const Text('Bluetooth pairing may be broken'),
content: const Text(
'The connection opened, then broke while reading the device. This is probably a pairing problem.\n\nOpen Bluetooth settings, remove/forget this device, then come back and connect again.',
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Not now'),
),
FilledButton(
onPressed: () async {
Navigator.of(context).pop();
await openBluetoothSettings();
},
child: const Text('Open Bluetooth settings'),
),
],
),
);
}

View File

@ -22,6 +22,10 @@ bool isConnectableAbawoDeviceGuid(Uuid guid) {
return isAbawoUniversalShiftersDeviceGuid(guid);
}
bool hasConnectableAbawoDeviceGuid(List<Uuid> guid) => guid
.map((id) => isConnectableAbawoDeviceGuid(id))
.fold(false, (v, e) => v || e);
bool isAbawoDeviceIdent(List<int> manuData) {
if (manuData.length < abawoManuIdentData.length) return false;
for (int i = 0; i < abawoManuIdentData.length; i++) {