feat: better pairing broken notification

This commit is contained in:
2026-05-05 21:06:11 +02:00
parent 230a6838e0
commit 4fceb0c690
5 changed files with 39 additions and 4 deletions

View File

@ -3,6 +3,10 @@ import 'dart:io';
import 'package:app_settings/app_settings.dart';
import 'package:flutter/material.dart';
bool isBluetoothPairingRecoveryError(Object error) {
return error.toString().toLowerCase().contains('disconnected');
}
Future<bool> openBluetoothSettings() async {
try {
if (Platform.isAndroid) {
@ -23,7 +27,8 @@ Future<void> showBluetoothPairingRecoveryDialog(BuildContext context) {
final content = isIOS
? 'The connection opened, then broke while reading the device. This is probably a pairing problem.\n\nGo to Settings, then Bluetooth, then forget this device. After that, come back and connect again.\n\nOr press Open Settings below. From the app settings page, press Back twice to reach Bluetooth settings, then forget this device.'
: '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.';
final settingsButtonLabel = isIOS ? 'Open Settings' : 'Open Bluetooth settings';
final settingsButtonLabel =
isIOS ? 'Open Settings' : 'Open Bluetooth settings';
return showDialog<void>(
context: context,