From 125c40b49af4c9eeffe6dd462445bddb185a38e5 Mon Sep 17 00:00:00 2001 From: Serhii Date: Wed, 27 Nov 2024 19:06:28 +0200 Subject: [PATCH] fix onramper network tag plus UI (#1832) --- lib/buy/onramper/onramper_buy_provider.dart | 3 +++ lib/src/screens/buy/buy_sell_page.dart | 5 +++-- lib/view_model/buy/buy_sell_view_model.dart | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/buy/onramper/onramper_buy_provider.dart b/lib/buy/onramper/onramper_buy_provider.dart index e4bf38275..827a5d448 100644 --- a/lib/buy/onramper/onramper_buy_provider.dart +++ b/lib/buy/onramper/onramper_buy_provider.dart @@ -248,9 +248,12 @@ class OnRamperBuyProvider extends BuyProvider { String _tagToNetwork(String tag) { switch (tag) { case 'OMNI': + case 'BSC': return tag; case 'POL': return 'POLYGON'; + case 'ZEC': + return 'ZCASH'; default: try { return CryptoCurrency.fromString(tag).fullName!; diff --git a/lib/src/screens/buy/buy_sell_page.dart b/lib/src/screens/buy/buy_sell_page.dart index d2f16fe3c..945559bb6 100644 --- a/lib/src/screens/buy/buy_sell_page.dart +++ b/lib/src/screens/buy/buy_sell_page.dart @@ -170,8 +170,9 @@ class BuySellPage extends BasePage { }, color: Theme.of(context).primaryColor, textColor: Colors.white, - isDisabled: false, - isLoading: !buySellViewModel.isReadyToTrade)), + isDisabled: buySellViewModel.isBuySellQuotFailed, + isLoading: !buySellViewModel.isReadyToTrade && + !buySellViewModel.isBuySellQuotFailed)), ]), )), )); diff --git a/lib/view_model/buy/buy_sell_view_model.dart b/lib/view_model/buy/buy_sell_view_model.dart index e1c53ee56..4d7151fac 100644 --- a/lib/view_model/buy/buy_sell_view_model.dart +++ b/lib/view_model/buy/buy_sell_view_model.dart @@ -155,13 +155,18 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S final hasSelectedPaymentMethod = selectedPaymentMethod != null; final isPaymentMethodLoaded = paymentMethodState is PaymentMethodLoaded; final isBuySellQuotLoaded = buySellQuotState is BuySellQuotLoaded; + final isBuySellQuotFailed = buySellQuotState is BuySellQuotFailed; return hasSelectedQuote && hasSelectedPaymentMethod && isPaymentMethodLoaded && - isBuySellQuotLoaded; + isBuySellQuotLoaded && + !isBuySellQuotFailed; } + @computed + bool get isBuySellQuotFailed => buySellQuotState is BuySellQuotFailed; + @action void reset() { cryptoCurrency = wallet.currency;