2023-03-01 21:44:15 +00:00
|
|
|
import 'package:cake_wallet/entities/exchange_api_mode.dart';
|
2023-08-04 17:01:49 +00:00
|
|
|
import 'package:cake_wallet/ethereum/ethereum.dart';
|
2022-11-23 17:06:41 +00:00
|
|
|
import 'package:cake_wallet/store/settings_store.dart';
|
2023-08-04 17:01:49 +00:00
|
|
|
import 'package:cw_core/wallet_base.dart';
|
|
|
|
import 'package:cw_core/wallet_type.dart';
|
2022-11-23 17:06:41 +00:00
|
|
|
import 'package:mobx/mobx.dart';
|
2022-12-06 23:38:36 +00:00
|
|
|
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
2022-11-23 17:06:41 +00:00
|
|
|
|
|
|
|
part 'privacy_settings_view_model.g.dart';
|
|
|
|
|
2022-12-01 19:21:51 +00:00
|
|
|
class PrivacySettingsViewModel = PrivacySettingsViewModelBase with _$PrivacySettingsViewModel;
|
2022-11-23 17:06:41 +00:00
|
|
|
|
|
|
|
abstract class PrivacySettingsViewModelBase with Store {
|
2023-08-04 17:01:49 +00:00
|
|
|
PrivacySettingsViewModelBase(this._settingsStore, this._wallet);
|
2022-11-23 17:06:41 +00:00
|
|
|
|
|
|
|
final SettingsStore _settingsStore;
|
2023-08-04 17:01:49 +00:00
|
|
|
final WalletBase _wallet;
|
2022-11-23 17:06:41 +00:00
|
|
|
|
2022-11-25 20:51:07 +00:00
|
|
|
@computed
|
2023-03-01 21:44:15 +00:00
|
|
|
ExchangeApiMode get exchangeStatus => _settingsStore.exchangeStatus;
|
2022-11-25 20:51:07 +00:00
|
|
|
|
2022-11-23 17:06:41 +00:00
|
|
|
@computed
|
2022-12-01 19:21:51 +00:00
|
|
|
bool get shouldSaveRecipientAddress => _settingsStore.shouldSaveRecipientAddress;
|
2022-11-23 17:06:41 +00:00
|
|
|
|
2022-12-06 23:38:36 +00:00
|
|
|
@computed
|
2023-02-28 16:23:21 +00:00
|
|
|
FiatApiMode get fiatApiMode => _settingsStore.fiatApiMode;
|
2022-12-06 23:38:36 +00:00
|
|
|
|
2023-04-20 09:59:59 +00:00
|
|
|
@computed
|
|
|
|
bool get isAppSecure => _settingsStore.isAppSecure;
|
|
|
|
|
2023-05-15 12:26:56 +00:00
|
|
|
@computed
|
|
|
|
bool get disableBuy => _settingsStore.disableBuy;
|
|
|
|
|
|
|
|
@computed
|
|
|
|
bool get disableSell => _settingsStore.disableSell;
|
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
@computed
|
|
|
|
bool get useEtherscan => _settingsStore.useEtherscan;
|
|
|
|
|
|
|
|
bool get canUseEtherscan => _wallet.type == WalletType.ethereum;
|
|
|
|
|
2022-11-23 17:06:41 +00:00
|
|
|
@action
|
2023-08-04 17:01:49 +00:00
|
|
|
void setShouldSaveRecipientAddress(bool value) =>
|
|
|
|
_settingsStore.shouldSaveRecipientAddress = value;
|
2022-12-01 19:21:51 +00:00
|
|
|
|
2022-11-25 20:51:07 +00:00
|
|
|
@action
|
2023-03-02 15:13:25 +00:00
|
|
|
void setExchangeApiMode(ExchangeApiMode value) => _settingsStore.exchangeStatus = value;
|
2022-12-06 23:38:36 +00:00
|
|
|
|
|
|
|
@action
|
2023-02-28 16:23:21 +00:00
|
|
|
void setFiatMode(FiatApiMode fiatApiMode) => _settingsStore.fiatApiMode = fiatApiMode;
|
2022-12-07 13:31:33 +00:00
|
|
|
|
2023-04-20 09:59:59 +00:00
|
|
|
@action
|
|
|
|
void setIsAppSecure(bool value) => _settingsStore.isAppSecure = value;
|
|
|
|
|
2023-05-15 12:26:56 +00:00
|
|
|
@action
|
|
|
|
void setDisableBuy(bool value) => _settingsStore.disableBuy = value;
|
|
|
|
|
|
|
|
@action
|
|
|
|
void setDisableSell(bool value) => _settingsStore.disableSell = value;
|
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
@action
|
|
|
|
void setUseEtherscan(bool value) {
|
|
|
|
_settingsStore.useEtherscan = value;
|
|
|
|
ethereum!.updateEtherscanUsageState(_wallet, value);
|
|
|
|
}
|
2022-12-01 19:21:51 +00:00
|
|
|
}
|