show warning if exchanging with slow fee (#579)

* show warning if exchanging with slow fee

* Update setDefaultTransactionPriority for return type void; update for use MoneroTransactionPriority.automatic instead of MoneroTransactionPriority.regular.

Co-authored-by: M <m@cakewallet.com>
This commit is contained in:
Serhii
2022-11-03 15:21:35 -04:00
committed by GitHub
co-authored by M
parent 8e70b611d0
commit a52f47220e
18 changed files with 122 additions and 1 deletions
@@ -111,6 +111,10 @@ class ExchangePage extends BasePage {
WidgetsBinding.instance
.addPostFrameCallback((_) => _setReactions(context, exchangeViewModel));
if (exchangeViewModel.isLowFee) {
_showFeeAlert(context);
}
return KeyboardActions(
disableScroll: true,
config: KeyboardActionsConfig(
@@ -794,5 +798,23 @@ class ExchangePage extends BasePage {
return address;
}
void _showFeeAlert(BuildContext context) async {
await Future<void>.delayed(Duration(seconds: 1));
final confirmed = await showPopUp<bool>(
context: context,
builder: (dialogContext) {
return AlertWithTwoActions(
alertTitle: S.of(context).low_fee,
alertContent: S.of(context).low_fee_alert,
leftButtonText: S.of(context).ignor,
rightButtonText: S.of(context).use_suggested,
actionLeftButton: () => Navigator.of(context).pop(false),
actionRightButton: () => Navigator.of(context).pop(true));
}) ?? false;
if (confirmed) {
exchangeViewModel.setDefaultTransactionPriority();
}
}
void disposeBestRateSync() => exchangeViewModel.bestRateSync?.cancel();
}