Add thread-safety and BLE support for Ledger and Trezor devices (#3638)

* feat: support BLE device detection for Ledger and Trezor wallets, update trezor-flutter dependency

* feat: add BLE connection state listener for Trezor devices, handle disconnect events, and clean up resources on close

* feat: add mutex locking to MoneroTrezorService for thread-safe operations
This commit is contained in:
Konstantin Ullrich
2026-09-18 21:10:59 +02:00
committed by GitHub
parent 410475b2b8
commit 3d03a62e21
9 changed files with 77 additions and 9 deletions
@@ -108,6 +108,8 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
_loadConnectedDevices();
_bleStateTimer = Timer.periodic(
const Duration(seconds: 1),
(_) => widget.hardwareWalletVM.updateBleState(),
@@ -131,6 +133,23 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
});
}
Future<void> _loadConnectedDevices() async {
try {
final connected = await widget.hardwareWalletVM.getConnectedBleDevices();
printV(connected);
if (!mounted || connected.isEmpty) {
return;
}
setState(() {
bleDevices.addAll(connected);
longWait = false;
});
} catch (e) {
printV(e);
}
}
@override
void dispose() {
_bleRefreshTimer?.cancel();