- Add Disable fiat API option to advanced privacy settings

This commit is contained in:
OmarHatem 2022-12-08 14:10:58 +02:00
parent fddac23b94
commit 6395d6b2f7

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/entities/fiat_api_mode.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/view_model/settings/switcher_list_item.dart'; import 'package:cake_wallet/view_model/settings/switcher_list_item.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
@ -11,15 +12,13 @@ class AdvancedPrivacySettingsViewModel = AdvancedPrivacySettingsViewModelBase
abstract class AdvancedPrivacySettingsViewModelBase with Store { abstract class AdvancedPrivacySettingsViewModelBase with Store {
AdvancedPrivacySettingsViewModelBase(this.type, this._settingsStore) AdvancedPrivacySettingsViewModelBase(this.type, this._settingsStore)
: _disableFiat = false, : _addCustomNode = false {
_addCustomNode = false {
settings = [ settings = [
// TODO: uncomment when Disable Fiat PR is merged SwitcherListItem(
// SwitcherListItem( title: S.current.disable_fiat,
// title: S.current.disable_fiat, value: () => _settingsStore.fiatApiMode == FiatApiMode.disabled,
// value: () => _disableFiat, onValueChange: (_, bool value) => setFiatMode(value),
// onValueChange: (_, bool value) => _disableFiat = value, ),
// ),
SwitcherListItem( SwitcherListItem(
title: S.current.disable_exchange, title: S.current.disable_exchange,
value: () => _settingsStore.disableExchange, value: () => _settingsStore.disableExchange,
@ -37,9 +36,6 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
late List<SwitcherListItem> settings; late List<SwitcherListItem> settings;
@observable
bool _disableFiat = false;
@observable @observable
bool _addCustomNode = false; bool _addCustomNode = false;
@ -48,4 +44,13 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
@computed @computed
bool get addCustomNode => _addCustomNode; bool get addCustomNode => _addCustomNode;
@action
void setFiatMode(bool value) {
if (value) {
_settingsStore.fiatApiMode = FiatApiMode.disabled;
return;
}
_settingsStore.fiatApiMode = FiatApiMode.enabled;
}
} }