CW-1291-ledger-fixes (#3390)

* feat: add connecting indicator in hardware wallet connect screen

* chore: bump ledger related dependencies

* chore: bump ledger related dependencies

* feat: add additional guard against gLedger being null

* auto-reformat

* feat: improve ledger connection and state management

* fix: connect_device_page padding on iOS

* chore: update universal_ble dependency reference

---------

Co-authored-by: Robert Malikowski <malikowskirobert@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
Konstantin Ullrich
2026-07-16 21:39:49 +03:00
committed by GitHub
co-authored by Robert Malikowski Omar Hatem
parent 0822c7d976
commit ed540bae04
12 changed files with 417 additions and 282 deletions
@@ -75,6 +75,23 @@ void startAuthenticationStateChange(
);
return;
}
ledgerVM.suppressMoneroReconnectPrompt = true;
if (!monero!.hasGlobalLedgerConnection()) {
await showPopUp<void>(
context: context,
builder: (context) => AlertWithOneAction(
alertTitle: "Unexpected Error",
alertContent:
"Unexpected Error while trying to connect to the device (has no global LedgerConnection)",
buttonText: S.of(context).try_again,
buttonAction: Navigator.of(context).pop,
),
);
return;
}
showPopUp<void>(
context: context,
builder: (context) => AlertWithOneAction(
@@ -85,14 +102,17 @@ void startAuthenticationStateChange(
buttonAction: () => Navigator.of(context).pop(),
),
);
bool tryOpening = true;
var isConnected = false;
var tryOpening = true;
while (tryOpening) {
try {
await loadCurrentWallet();
isConnected = true;
tryOpening = false;
} on Exception catch (e) {
final ledgerErrorMessage = ledgerVM.interpretErrorCode(e.toString());
if (ledgerErrorMessage != null) {
if (ledgerErrorMessage != null && context.mounted) {
await showPopUp<void>(
context: context,
builder: (context) => AlertWithTwoActions(
@@ -116,16 +136,17 @@ void startAuthenticationStateChange(
}
getIt.get<BottomSheetService>().showNext();
await navigatorKey.currentState!
.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
if (isConnected) {
ledgerVM.suppressMoneroReconnectPrompt = false;
await navigatorKey.currentState!
.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
}
},
allowChangeWallet: true,
),
);
// await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.connectDevices, (route) => false, arguments: ConnectDevicePageParams(walletType: walletType, onConnectDevice: onConnectDevice));
} else {
navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
}
WidgetsBinding.instance.addPostFrameCallback((_) {
final linkViewModel = getIt.get<LinkViewModel>();