Fix rescan popup not working without wifi
This commit is contained in:
parent
14e884c514
commit
010b299920
|
@ -477,11 +477,11 @@ class _AccountPageState extends State<AccountPage>
|
|||
}
|
||||
}
|
||||
|
||||
_rescan() {
|
||||
rescanDialog(context, () {
|
||||
Navigator.of(context).pop();
|
||||
_rescan() async {
|
||||
final approved = await rescanDialog(context);
|
||||
if (approved) {
|
||||
syncStatus.sync(context);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_cold() {
|
||||
|
|
|
@ -120,10 +120,9 @@ class AccountManagerState extends State<AccountManagerPage> {
|
|||
await accountManager.setActiveAccount(account);
|
||||
if (syncStatus.accountRestored) {
|
||||
syncStatus.setAccountRestored(false);
|
||||
await rescanDialog(context, () {
|
||||
syncStatus.sync(context);
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
final approved = await rescanDialog(context);
|
||||
if (approved)
|
||||
syncStatus.sync(context);
|
||||
}
|
||||
else if (syncStatus.syncedHeight < 0) {
|
||||
syncStatus.setSyncedToLatestHeight();
|
||||
|
|
|
@ -221,31 +221,32 @@ void showQR(BuildContext context, String text) {
|
|||
));
|
||||
}
|
||||
|
||||
Future<void> rescanDialog(
|
||||
BuildContext context, VoidCallback continuation) async {
|
||||
await showDialog(
|
||||
Future<bool> rescanDialog(
|
||||
BuildContext context) async {
|
||||
final approved = await showDialog<bool>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(S.of(context).rescan),
|
||||
content: Text(S.of(context).rescanWalletFromTheFirstBlock),
|
||||
actions: confirmButtons(context, () => confirmWifi(context, continuation))));
|
||||
actions: confirmButtons(context, () => Navigator.of(context).pop(true), cancelValue: false))) ?? false;
|
||||
if (approved)
|
||||
return await confirmWifi(context);
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<void> confirmWifi(BuildContext context, VoidCallback continuation) async {
|
||||
Future<bool> confirmWifi(BuildContext context) async {
|
||||
final connectivity = await Connectivity().checkConnectivity();
|
||||
if (connectivity == ConnectivityResult.mobile) {
|
||||
Navigator.of(context).pop();
|
||||
await showDialog(
|
||||
return await showDialog<bool?>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(S.of(context).rescan),
|
||||
content: Text('On Mobile Data, scanning may incur additional charges. Do you want to proceed?'),
|
||||
actions: confirmButtons(context, continuation)));
|
||||
actions: confirmButtons(context, () => Navigator.of(context).pop(true), cancelValue: false))) ?? false;
|
||||
}
|
||||
else
|
||||
continuation();
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<bool> showMessageBox(
|
||||
|
|
Loading…
Reference in New Issue