diff --git a/lib/reactions/on_authentication_state_change.dart b/lib/reactions/on_authentication_state_change.dart index d7652f78f..1abf40b66 100644 --- a/lib/reactions/on_authentication_state_change.dart +++ b/lib/reactions/on_authentication_state_change.dart @@ -61,8 +61,21 @@ void startAuthenticationStateChange( walletType: WalletType.monero, hardwareWalletType: HardwareWalletType.ledger, onConnectDevice: (context, ledgerVM) async { - if (ledgerVM is LedgerViewModel) + if (ledgerVM is LedgerViewModel) { monero!.setGlobalLedgerConnection(ledgerVM.connection); + } else { + await showPopUp( + context: context, + builder: (context) => AlertWithOneAction( + alertTitle: "Unexpected Error", + alertContent: + "Unexpected Error while trying to connect to the device (UnexpectedViewModel: ${ledgerVM.toString()})", + buttonText: S.of(context).try_again, + buttonAction: Navigator.of(context).pop, + ), + ); + return; + } showPopUp( context: context, builder: (context) => AlertWithOneAction( diff --git a/lib/src/screens/wallet_list/wallet_list_page.dart b/lib/src/screens/wallet_list/wallet_list_page.dart index bf882a4e6..7343288a7 100644 --- a/lib/src/screens/wallet_list/wallet_list_page.dart +++ b/lib/src/screens/wallet_list/wallet_list_page.dart @@ -29,7 +29,6 @@ import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart'; import 'package:cake_wallet/wallet_type_utils.dart'; import 'package:cw_core/currency_for_wallet_type.dart'; import 'package:cw_core/wallet_info.dart'; -import 'package:cw_core/utils/print_verbose.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -484,10 +483,11 @@ class WalletListBodyState extends State { walletType: WalletType.monero, hardwareWalletType: HardwareWalletType.ledger, onConnectDevice: (context, ledgerVM) async { - if (ledgerVM is LedgerViewModel) + if (ledgerVM is LedgerViewModel) { monero!.setGlobalLedgerConnection(ledgerVM.connection); - didConnect = true; - Navigator.of(context).pop(); + didConnect = true; + Navigator.of(context).pop(); + } }, isReconnect: true, ), diff --git a/lib/utils/exception_handler.dart b/lib/utils/exception_handler.dart index edb5fe776..3446e481a 100644 --- a/lib/utils/exception_handler.dart +++ b/lib/utils/exception_handler.dart @@ -293,6 +293,7 @@ class ExceptionHandler { "FocusScopeNode was used after being disposed", "_getDismissibleFlushbar", + "_QueuedFuture.execute (package:universal_ble/src/queue.dart:65)", ]; static Future _addDeviceInfo(File file) async {