disable swap until synced for btc/ltc/xmr

This commit is contained in:
OmarHatem 2025-05-20 03:10:49 +03:00
parent 1e5568fc1b
commit dcaeac9b85

View file

@ -97,6 +97,11 @@ class ExchangePage extends BasePage {
}
};
bool get _shouldWaitTillSynced =>
[CryptoCurrency.xmr, CryptoCurrency.btc, CryptoCurrency.ltc]
.contains(exchangeViewModel.depositCurrency) &&
!(exchangeViewModel.status is SyncedSyncStatus);
@override
Widget middle(BuildContext context) => Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -254,16 +259,17 @@ class ExchangePage extends BasePage {
if (_formKey.currentState != null &&
_formKey.currentState!.validate()) {
if ((exchangeViewModel.depositCurrency == CryptoCurrency.xmr) &&
(!(exchangeViewModel.status is SyncedSyncStatus))) {
if (_shouldWaitTillSynced) {
showPopUp<void>(
context: context,
builder: (BuildContext context) {
return AlertWithOneAction(
alertTitle: S.of(context).exchange,
alertContent: S.of(context).exchange_sync_alert_content,
alertContent:
S.of(context).exchange_sync_alert_content,
buttonText: S.of(context).ok,
buttonAction: () => Navigator.of(context).pop());
buttonAction: () => Navigator.of(context).pop(),
);
});
} else {
final check = exchangeViewModel.shouldDisplayTOTP();