diff --git a/lib/exchange/changenow/changenow_exchange_provider.dart b/lib/exchange/changenow/changenow_exchange_provider.dart index df5afe5ab..e02ae66a9 100644 --- a/lib/exchange/changenow/changenow_exchange_provider.dart +++ b/lib/exchange/changenow/changenow_exchange_provider.dart @@ -19,7 +19,9 @@ class ChangeNowExchangeProvider extends ExchangeProvider { : _lastUsedRateId = '', super( pairList: CryptoCurrency.all + .where((i) => i != CryptoCurrency.xhv) .map((i) => CryptoCurrency.all + .where((i) => i != CryptoCurrency.xhv) .map((k) => ExchangePair(from: i, to: k, reverse: true)) .where((c) => c != null)) .expand((i) => i) diff --git a/lib/exchange/sideshift/sideshift_exchange_provider.dart b/lib/exchange/sideshift/sideshift_exchange_provider.dart index 878ffd528..7b2531873 100644 --- a/lib/exchange/sideshift/sideshift_exchange_provider.dart +++ b/lib/exchange/sideshift/sideshift_exchange_provider.dart @@ -19,7 +19,9 @@ class SideShiftExchangeProvider extends ExchangeProvider { SideShiftExchangeProvider() : super( pairList: CryptoCurrency.all + .where((i) => i != CryptoCurrency.xhv) .map((i) => CryptoCurrency.all + .where((i) => i != CryptoCurrency.xhv) .map((k) => ExchangePair(from: i, to: k, reverse: true)) .where((c) => c != null)) .expand((i) => i) diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index 6ed07850f..607e5c3f9 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -314,22 +314,6 @@ class DashboardPage extends BasePage { } Future _onClickExchangeButton(BuildContext context) async { - final walletType = walletViewModel.type; - - switch (walletType) { - case WalletType.haven: - await showPopUp( - context: context, - builder: (BuildContext context) { - return AlertWithOneAction( - alertTitle: 'Exchange', - alertContent: 'Exchange for this asset is not supported yet.', - buttonText: S.of(context).ok, - buttonAction: () => Navigator.of(context).pop()); - }); - break; - default: - await Navigator.of(context).pushNamed(Routes.exchange); - } + await Navigator.of(context).pushNamed(Routes.exchange); } } diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 1a7a44406..b5d50e7e4 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -337,7 +337,7 @@ abstract class DashboardViewModelBase with Store { } void updateActions() { - isEnabledExchangeAction = wallet.type != WalletType.haven; + isEnabledExchangeAction = true; hasExchangeAction = !isHaven; isEnabledBuyAction = wallet.type != WalletType.haven && wallet.type != WalletType.monero; diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index d91c393ab..d55d4f9df 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -40,10 +40,10 @@ class ExchangeViewModel = ExchangeViewModelBase with _$ExchangeViewModel; abstract class ExchangeViewModelBase with Store { ExchangeViewModelBase(this.wallet, this.trades, this._exchangeTemplateStore, this.tradesStore, this._settingsStore, this.sharedPreferences) { - const excludeDepositCurrencies = [CryptoCurrency.xhv]; - const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp, CryptoCurrency.bnb, CryptoCurrency.xhv]; + const excludeDepositCurrencies = []; + const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp, CryptoCurrency.bnb]; providerList = [ChangeNowExchangeProvider(), SideShiftExchangeProvider(), SimpleSwapExchangeProvider()]; - + _initialPairBasedOnWallet(); currentTradeAvailableProviders = SplayTreeMap(); final Map exchangeProvidersSelection = json @@ -51,13 +51,12 @@ abstract class ExchangeViewModelBase with Store { /// if the provider is not in the user settings (user's first time or newly added provider) /// then use its default value decided by us - selectedProviders = ObservableList.of(providerList.where( + selectedProviders = ObservableList.of(providersForCurrentPair().where( (element) => exchangeProvidersSelection[element.title] == null ? element.isEnabled : (exchangeProvidersSelection[element.title] as bool)) .toList()); - _initialPairBasedOnWallet(); isDepositAddressEnabled = !(depositCurrency == wallet.currency); isReceiveAddressEnabled = !(receiveCurrency == wallet.currency); depositAmount = ''; @@ -532,6 +531,10 @@ abstract class ExchangeViewModelBase with Store { depositCurrency = CryptoCurrency.ltc; receiveCurrency = CryptoCurrency.xmr; break; + case WalletType.haven: + depositCurrency = CryptoCurrency.xhv; + receiveCurrency = CryptoCurrency.btc; + break; default: break; }