diff --git a/lib/core/backup_service.dart b/lib/core/backup_service.dart index ffcb9eb4c..0439e9fb4 100644 --- a/lib/core/backup_service.dart +++ b/lib/core/backup_service.dart @@ -217,7 +217,7 @@ class BackupService { final fiatApiMode = data[PreferencesKey.currentFiatApiModeKey] as int?; final currentPinLength = data[PreferencesKey.currentPinLength] as int?; final currentTheme = data[PreferencesKey.currentTheme] as int?; - final disableExchange = data[PreferencesKey.disableExchangeKey] as bool?; + final exchangeStatus = data[PreferencesKey.exchangeStatusKey] as bool?; final currentDefaultSettingsMigrationVersion = data[PreferencesKey.currentDefaultSettingsMigrationVersion] as int?; final moneroTransactionPriority = data[PreferencesKey.moneroTransactionPriority] as int?; final bitcoinTransactionPriority = data[PreferencesKey.bitcoinTransactionPriority] as int?; @@ -280,9 +280,9 @@ class BackupService { await _sharedPreferences.setInt( PreferencesKey.currentTheme, currentTheme); - if (disableExchange != null) + if (exchangeStatus != null) await _sharedPreferences.setBool( - PreferencesKey.disableExchangeKey, disableExchange); + PreferencesKey.exchangeStatusKey, exchangeStatus); if (currentDefaultSettingsMigrationVersion != null) await _sharedPreferences.setInt( @@ -431,8 +431,8 @@ class BackupService { _sharedPreferences.getInt(PreferencesKey.displayActionListModeKey), PreferencesKey.currentTheme: _sharedPreferences.getInt(PreferencesKey.currentTheme), - PreferencesKey.disableExchangeKey: - _sharedPreferences.getBool(PreferencesKey.disableExchangeKey), + PreferencesKey.exchangeStatusKey: + _sharedPreferences.getBool(PreferencesKey.exchangeStatusKey), PreferencesKey.currentDefaultSettingsMigrationVersion: _sharedPreferences .getInt(PreferencesKey.currentDefaultSettingsMigrationVersion), PreferencesKey.bitcoinTransactionPriority: diff --git a/lib/exchange/trocador/trocador_exchange_provider.dart b/lib/exchange/trocador/trocador_exchange_provider.dart index 750ffb98a..e289b4e0b 100644 --- a/lib/exchange/trocador/trocador_exchange_provider.dart +++ b/lib/exchange/trocador/trocador_exchange_provider.dart @@ -308,7 +308,7 @@ class TrocadorExchangeProvider extends ExchangeProvider { return onionApiAuthority; } - final uri = Uri.https(onionApiAuthority, '/api/trade'); + final uri = Uri.https(onionApiAuthority, tradePath); await get(uri); return onionApiAuthority; diff --git a/lib/src/screens/new_wallet/advanced_privacy_settings_page.dart b/lib/src/screens/new_wallet/advanced_privacy_settings_page.dart index 42ba0debb..a82ddaf4e 100644 --- a/lib/src/screens/new_wallet/advanced_privacy_settings_page.dart +++ b/lib/src/screens/new_wallet/advanced_privacy_settings_page.dart @@ -70,7 +70,7 @@ class _AdvancedPrivacySettingsBodyState extends State - widget.privacySettingsViewModel.setEnableExchange(mode), + widget.privacySettingsViewModel.setExchangeApiMode(mode), ), ); } diff --git a/lib/src/screens/settings/privacy_page.dart b/lib/src/screens/settings/privacy_page.dart index cc6acc826..5322c488f 100644 --- a/lib/src/screens/settings/privacy_page.dart +++ b/lib/src/screens/settings/privacy_page.dart @@ -36,7 +36,7 @@ class PrivacyPage extends BasePage { title: S.current.exchange, items: ExchangeApiMode.all, selectedItem: _privacySettingsViewModel.exchangeStatus, - onItemSelected: (ExchangeApiMode mode) => _privacySettingsViewModel.setEnableExchange(mode), + onItemSelected: (ExchangeApiMode mode) => _privacySettingsViewModel.setExchangeApiMode(mode), ), ), SettingsSwitcherCell( diff --git a/lib/view_model/advanced_privacy_settings_view_model.dart b/lib/view_model/advanced_privacy_settings_view_model.dart index 1bc2ecd9f..fad5fff34 100644 --- a/lib/view_model/advanced_privacy_settings_view_model.dart +++ b/lib/view_model/advanced_privacy_settings_view_model.dart @@ -38,7 +38,7 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store { } @action - void setEnableExchange(ExchangeApiMode value) { + void setExchangeApiMode(ExchangeApiMode value) { _settingsStore.exchangeStatus = value; } diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index dab2bafd1..4bc6e577d 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/entities/exchange_api_mode.dart'; import 'package:cake_wallet/entities/fiat_api_mode.dart'; import 'package:cake_wallet/wallet_type_utils.dart'; import 'package:cw_core/transaction_history.dart'; @@ -274,7 +275,7 @@ abstract class DashboardViewModelBase with Store { settingsStore.shouldShowYatPopup = shouldShow; @computed - bool get isEnabledExchangeAction => settingsStore.exchangeStatus != FiatApiMode.disabled; + bool get isEnabledExchangeAction => settingsStore.exchangeStatus != ExchangeApiMode.disabled; @observable bool hasExchangeAction; diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index 20a5a8e76..d0698990c 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:collection'; import 'dart:convert'; +import 'package:cake_wallet/entities/exchange_api_mode.dart'; import 'package:cake_wallet/entities/fiat_api_mode.dart'; import 'package:cake_wallet/entities/preferences_key.dart'; import 'package:cake_wallet/exchange/sideshift/sideshift_exchange_provider.dart'; @@ -56,7 +57,7 @@ abstract class ExchangeViewModelBase with Store { isDepositAddressEnabled = false, isReceiveAddressEnabled = false, isReceiveAmountEditable = false, - _providerUseTorOnly = false, + _useTorOnly = false, receiveCurrencies = [], depositCurrencies = [], limits = Limits(min: 0, max: 0), @@ -66,7 +67,7 @@ abstract class ExchangeViewModelBase with Store { depositCurrency = wallet.currency, providerList = [], selectedProviders = ObservableList() { - _providerUseTorOnly = _settingsStore.exchangeStatus == FiatApiMode.torOnly; + _useTorOnly = _settingsStore.exchangeStatus == ExchangeApiMode.torOnly; _setProviders(); const excludeDepositCurrencies = [CryptoCurrency.btt, CryptoCurrency.nano]; const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp, @@ -123,7 +124,7 @@ abstract class ExchangeViewModelBase with Store { _calculateBestRate(); }); } - bool _providerUseTorOnly; + bool _useTorOnly; final WalletBase wallet; final Box trades; final ExchangeTemplateStore _exchangeTemplateStore; @@ -134,7 +135,7 @@ abstract class ExchangeViewModelBase with Store { ChangeNowExchangeProvider(), SideShiftExchangeProvider(), SimpleSwapExchangeProvider(), - TrocadorExchangeProvider(useTorOnly: _providerUseTorOnly), + TrocadorExchangeProvider(useTorOnly: _useTorOnly), ]; @observable @@ -696,7 +697,7 @@ abstract class ExchangeViewModelBase with Store { } void _setProviders(){ - if (_settingsStore.exchangeStatus == FiatApiMode.torOnly) { + if (_settingsStore.exchangeStatus == ExchangeApiMode.torOnly) { providerList = _allProviders.where((provider) => provider.supportsOnionAddress).toList(); } else { providerList = _allProviders; diff --git a/lib/view_model/settings/privacy_settings_view_model.dart b/lib/view_model/settings/privacy_settings_view_model.dart index 1919b1944..1d58fc323 100644 --- a/lib/view_model/settings/privacy_settings_view_model.dart +++ b/lib/view_model/settings/privacy_settings_view_model.dart @@ -25,7 +25,7 @@ abstract class PrivacySettingsViewModelBase with Store { void setShouldSaveRecipientAddress(bool value) => _settingsStore.shouldSaveRecipientAddress = value; @action - void setEnableExchange(ExchangeApiMode value) => _settingsStore.exchangeStatus = value; + void setExchangeApiMode(ExchangeApiMode value) => _settingsStore.exchangeStatus = value; @action void setFiatMode(bool value) { diff --git a/pubspec_base.yaml b/pubspec_base.yaml index 7ff933520..2caa9052f 100644 --- a/pubspec_base.yaml +++ b/pubspec_base.yaml @@ -56,7 +56,6 @@ dependencies: archive: ^3.3.0 cryptography: ^2.0.5 file_picker: ^4.6.1 - file: ^6.1.4 unorm_dart: ^0.2.0 # check unorm_dart for usage and for replace permission_handler: ^10.0.0