mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
fix: handle unexpected ViewModel in ledger connection process (#2716)
* fix: handle unexpected ViewModel in ledger connection process * fix: add missing exception handler for `_QueuedFuture.execute` in `exception_handler.dart`
This commit is contained in:
@@ -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<void>(
|
||||
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<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertWithOneAction(
|
||||
|
||||
@@ -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<WalletListBody> {
|
||||
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,
|
||||
),
|
||||
|
||||
@@ -293,6 +293,7 @@ class ExceptionHandler {
|
||||
|
||||
"FocusScopeNode was used after being disposed",
|
||||
"_getDismissibleFlushbar",
|
||||
"_QueuedFuture.execute (package:universal_ble/src/queue.dart:65)",
|
||||
];
|
||||
|
||||
static Future<void> _addDeviceInfo(File file) async {
|
||||
|
||||
Reference in New Issue
Block a user