2022-11-23 17:06:41 +00:00
|
|
|
import 'package:cake_wallet/store/settings_store.dart';
|
|
|
|
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 {
|
|
|
|
PrivacySettingsViewModelBase(this._settingsStore);
|
|
|
|
|
|
|
|
final SettingsStore _settingsStore;
|
|
|
|
|
2022-11-25 20:51:07 +00:00
|
|
|
@computed
|
|
|
|
bool get disableExchange => _settingsStore.disableExchange;
|
|
|
|
|
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
|
2022-12-07 20:07:32 +00:00
|
|
|
bool get isFiatDisabled => _settingsStore.fiatApiMode == FiatApiMode.disabled;
|
2022-12-06 23:38:36 +00:00
|
|
|
|
2022-11-23 17:06:41 +00:00
|
|
|
@action
|
2022-12-01 19:21:51 +00:00
|
|
|
void setShouldSaveRecipientAddress(bool value) => _settingsStore.shouldSaveRecipientAddress = value;
|
|
|
|
|
2022-11-25 20:51:07 +00:00
|
|
|
@action
|
2022-12-01 19:21:51 +00:00
|
|
|
void setEnableExchange(bool value) => _settingsStore.disableExchange = value;
|
2022-12-06 23:38:36 +00:00
|
|
|
|
|
|
|
@action
|
2022-12-07 13:31:33 +00:00
|
|
|
void setFiatMode(bool value) {
|
|
|
|
if (value) {
|
|
|
|
_settingsStore.fiatApiMode = FiatApiMode.disabled;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
_settingsStore.fiatApiMode = FiatApiMode.enabled;
|
|
|
|
}
|
|
|
|
|
2022-12-01 19:21:51 +00:00
|
|
|
}
|