mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-24 11:36:21 +00:00
Fix issues from code review
This commit is contained in:
parent
d4b5f24d5e
commit
15237d5f79
9 changed files with 18 additions and 17 deletions
|
@ -217,7 +217,7 @@ class BackupService {
|
||||||
final fiatApiMode = data[PreferencesKey.currentFiatApiModeKey] as int?;
|
final fiatApiMode = data[PreferencesKey.currentFiatApiModeKey] as int?;
|
||||||
final currentPinLength = data[PreferencesKey.currentPinLength] as int?;
|
final currentPinLength = data[PreferencesKey.currentPinLength] as int?;
|
||||||
final currentTheme = data[PreferencesKey.currentTheme] 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 currentDefaultSettingsMigrationVersion = data[PreferencesKey.currentDefaultSettingsMigrationVersion] as int?;
|
||||||
final moneroTransactionPriority = data[PreferencesKey.moneroTransactionPriority] as int?;
|
final moneroTransactionPriority = data[PreferencesKey.moneroTransactionPriority] as int?;
|
||||||
final bitcoinTransactionPriority = data[PreferencesKey.bitcoinTransactionPriority] as int?;
|
final bitcoinTransactionPriority = data[PreferencesKey.bitcoinTransactionPriority] as int?;
|
||||||
|
@ -280,9 +280,9 @@ class BackupService {
|
||||||
await _sharedPreferences.setInt(
|
await _sharedPreferences.setInt(
|
||||||
PreferencesKey.currentTheme, currentTheme);
|
PreferencesKey.currentTheme, currentTheme);
|
||||||
|
|
||||||
if (disableExchange != null)
|
if (exchangeStatus != null)
|
||||||
await _sharedPreferences.setBool(
|
await _sharedPreferences.setBool(
|
||||||
PreferencesKey.disableExchangeKey, disableExchange);
|
PreferencesKey.exchangeStatusKey, exchangeStatus);
|
||||||
|
|
||||||
if (currentDefaultSettingsMigrationVersion != null)
|
if (currentDefaultSettingsMigrationVersion != null)
|
||||||
await _sharedPreferences.setInt(
|
await _sharedPreferences.setInt(
|
||||||
|
@ -431,8 +431,8 @@ class BackupService {
|
||||||
_sharedPreferences.getInt(PreferencesKey.displayActionListModeKey),
|
_sharedPreferences.getInt(PreferencesKey.displayActionListModeKey),
|
||||||
PreferencesKey.currentTheme:
|
PreferencesKey.currentTheme:
|
||||||
_sharedPreferences.getInt(PreferencesKey.currentTheme),
|
_sharedPreferences.getInt(PreferencesKey.currentTheme),
|
||||||
PreferencesKey.disableExchangeKey:
|
PreferencesKey.exchangeStatusKey:
|
||||||
_sharedPreferences.getBool(PreferencesKey.disableExchangeKey),
|
_sharedPreferences.getBool(PreferencesKey.exchangeStatusKey),
|
||||||
PreferencesKey.currentDefaultSettingsMigrationVersion: _sharedPreferences
|
PreferencesKey.currentDefaultSettingsMigrationVersion: _sharedPreferences
|
||||||
.getInt(PreferencesKey.currentDefaultSettingsMigrationVersion),
|
.getInt(PreferencesKey.currentDefaultSettingsMigrationVersion),
|
||||||
PreferencesKey.bitcoinTransactionPriority:
|
PreferencesKey.bitcoinTransactionPriority:
|
||||||
|
|
|
@ -308,7 +308,7 @@ class TrocadorExchangeProvider extends ExchangeProvider {
|
||||||
return onionApiAuthority;
|
return onionApiAuthority;
|
||||||
}
|
}
|
||||||
|
|
||||||
final uri = Uri.https(onionApiAuthority, '/api/trade');
|
final uri = Uri.https(onionApiAuthority, tradePath);
|
||||||
await get(uri);
|
await get(uri);
|
||||||
|
|
||||||
return onionApiAuthority;
|
return onionApiAuthority;
|
||||||
|
|
|
@ -70,7 +70,7 @@ class _AdvancedPrivacySettingsBodyState extends State<AdvancedPrivacySettingsBod
|
||||||
items: ExchangeApiMode.all,
|
items: ExchangeApiMode.all,
|
||||||
selectedItem: widget.privacySettingsViewModel.exchangeStatus,
|
selectedItem: widget.privacySettingsViewModel.exchangeStatus,
|
||||||
onItemSelected: (ExchangeApiMode mode) =>
|
onItemSelected: (ExchangeApiMode mode) =>
|
||||||
widget.privacySettingsViewModel.setEnableExchange(mode),
|
widget.privacySettingsViewModel.setExchangeApiMode(mode),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class PrivacyPage extends BasePage {
|
||||||
title: S.current.exchange,
|
title: S.current.exchange,
|
||||||
items: ExchangeApiMode.all,
|
items: ExchangeApiMode.all,
|
||||||
selectedItem: _privacySettingsViewModel.exchangeStatus,
|
selectedItem: _privacySettingsViewModel.exchangeStatus,
|
||||||
onItemSelected: (ExchangeApiMode mode) => _privacySettingsViewModel.setEnableExchange(mode),
|
onItemSelected: (ExchangeApiMode mode) => _privacySettingsViewModel.setExchangeApiMode(mode),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SettingsSwitcherCell(
|
SettingsSwitcherCell(
|
||||||
|
|
|
@ -38,7 +38,7 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setEnableExchange(ExchangeApiMode value) {
|
void setExchangeApiMode(ExchangeApiMode value) {
|
||||||
_settingsStore.exchangeStatus = value;
|
_settingsStore.exchangeStatus = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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/entities/fiat_api_mode.dart';
|
||||||
import 'package:cake_wallet/wallet_type_utils.dart';
|
import 'package:cake_wallet/wallet_type_utils.dart';
|
||||||
import 'package:cw_core/transaction_history.dart';
|
import 'package:cw_core/transaction_history.dart';
|
||||||
|
@ -274,7 +275,7 @@ abstract class DashboardViewModelBase with Store {
|
||||||
settingsStore.shouldShowYatPopup = shouldShow;
|
settingsStore.shouldShowYatPopup = shouldShow;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
bool get isEnabledExchangeAction => settingsStore.exchangeStatus != FiatApiMode.disabled;
|
bool get isEnabledExchangeAction => settingsStore.exchangeStatus != ExchangeApiMode.disabled;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
bool hasExchangeAction;
|
bool hasExchangeAction;
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
import 'dart:convert';
|
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/fiat_api_mode.dart';
|
||||||
import 'package:cake_wallet/entities/preferences_key.dart';
|
import 'package:cake_wallet/entities/preferences_key.dart';
|
||||||
import 'package:cake_wallet/exchange/sideshift/sideshift_exchange_provider.dart';
|
import 'package:cake_wallet/exchange/sideshift/sideshift_exchange_provider.dart';
|
||||||
|
@ -56,7 +57,7 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
isDepositAddressEnabled = false,
|
isDepositAddressEnabled = false,
|
||||||
isReceiveAddressEnabled = false,
|
isReceiveAddressEnabled = false,
|
||||||
isReceiveAmountEditable = false,
|
isReceiveAmountEditable = false,
|
||||||
_providerUseTorOnly = false,
|
_useTorOnly = false,
|
||||||
receiveCurrencies = <CryptoCurrency>[],
|
receiveCurrencies = <CryptoCurrency>[],
|
||||||
depositCurrencies = <CryptoCurrency>[],
|
depositCurrencies = <CryptoCurrency>[],
|
||||||
limits = Limits(min: 0, max: 0),
|
limits = Limits(min: 0, max: 0),
|
||||||
|
@ -66,7 +67,7 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
depositCurrency = wallet.currency,
|
depositCurrency = wallet.currency,
|
||||||
providerList = [],
|
providerList = [],
|
||||||
selectedProviders = ObservableList<ExchangeProvider>() {
|
selectedProviders = ObservableList<ExchangeProvider>() {
|
||||||
_providerUseTorOnly = _settingsStore.exchangeStatus == FiatApiMode.torOnly;
|
_useTorOnly = _settingsStore.exchangeStatus == ExchangeApiMode.torOnly;
|
||||||
_setProviders();
|
_setProviders();
|
||||||
const excludeDepositCurrencies = [CryptoCurrency.btt, CryptoCurrency.nano];
|
const excludeDepositCurrencies = [CryptoCurrency.btt, CryptoCurrency.nano];
|
||||||
const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp,
|
const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp,
|
||||||
|
@ -123,7 +124,7 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
_calculateBestRate();
|
_calculateBestRate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
bool _providerUseTorOnly;
|
bool _useTorOnly;
|
||||||
final WalletBase wallet;
|
final WalletBase wallet;
|
||||||
final Box<Trade> trades;
|
final Box<Trade> trades;
|
||||||
final ExchangeTemplateStore _exchangeTemplateStore;
|
final ExchangeTemplateStore _exchangeTemplateStore;
|
||||||
|
@ -134,7 +135,7 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
ChangeNowExchangeProvider(),
|
ChangeNowExchangeProvider(),
|
||||||
SideShiftExchangeProvider(),
|
SideShiftExchangeProvider(),
|
||||||
SimpleSwapExchangeProvider(),
|
SimpleSwapExchangeProvider(),
|
||||||
TrocadorExchangeProvider(useTorOnly: _providerUseTorOnly),
|
TrocadorExchangeProvider(useTorOnly: _useTorOnly),
|
||||||
];
|
];
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
|
@ -696,7 +697,7 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _setProviders(){
|
void _setProviders(){
|
||||||
if (_settingsStore.exchangeStatus == FiatApiMode.torOnly) {
|
if (_settingsStore.exchangeStatus == ExchangeApiMode.torOnly) {
|
||||||
providerList = _allProviders.where((provider) => provider.supportsOnionAddress).toList();
|
providerList = _allProviders.where((provider) => provider.supportsOnionAddress).toList();
|
||||||
} else {
|
} else {
|
||||||
providerList = _allProviders;
|
providerList = _allProviders;
|
||||||
|
|
|
@ -25,7 +25,7 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||||
void setShouldSaveRecipientAddress(bool value) => _settingsStore.shouldSaveRecipientAddress = value;
|
void setShouldSaveRecipientAddress(bool value) => _settingsStore.shouldSaveRecipientAddress = value;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setEnableExchange(ExchangeApiMode value) => _settingsStore.exchangeStatus = value;
|
void setExchangeApiMode(ExchangeApiMode value) => _settingsStore.exchangeStatus = value;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setFiatMode(bool value) {
|
void setFiatMode(bool value) {
|
||||||
|
|
|
@ -56,7 +56,6 @@ dependencies:
|
||||||
archive: ^3.3.0
|
archive: ^3.3.0
|
||||||
cryptography: ^2.0.5
|
cryptography: ^2.0.5
|
||||||
file_picker: ^4.6.1
|
file_picker: ^4.6.1
|
||||||
file: ^6.1.4
|
|
||||||
unorm_dart: ^0.2.0
|
unorm_dart: ^0.2.0
|
||||||
# check unorm_dart for usage and for replace
|
# check unorm_dart for usage and for replace
|
||||||
permission_handler: ^10.0.0
|
permission_handler: ^10.0.0
|
||||||
|
|
Loading…
Reference in a new issue