mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-24 11:36:21 +00:00
[skip ci] format files
This commit is contained in:
parent
658d4766c6
commit
03748d680a
5 changed files with 58 additions and 80 deletions
|
@ -19,24 +19,24 @@ class PrivacyPage extends BasePage {
|
||||||
padding: EdgeInsets.only(top: 10),
|
padding: EdgeInsets.only(top: 10),
|
||||||
child: Observer(builder: (_) {
|
child: Observer(builder: (_) {
|
||||||
return Observer(builder: (_) {
|
return Observer(builder: (_) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
SettingsSwitcherCell(
|
SettingsSwitcherCell(
|
||||||
title: S.current.disable_exchange,
|
title: S.current.disable_exchange,
|
||||||
value: _privacySettingsViewModel.disableExchange,
|
value: _privacySettingsViewModel.disableExchange,
|
||||||
onValueChange: (BuildContext context, bool value) {
|
onValueChange: (BuildContext context, bool value) {
|
||||||
_privacySettingsViewModel.setEnableExchange(value);
|
_privacySettingsViewModel.setEnableExchange(value);
|
||||||
}),
|
}),
|
||||||
SettingsSwitcherCell(
|
SettingsSwitcherCell(
|
||||||
title: S.current.settings_save_recipient_address,
|
title: S.current.settings_save_recipient_address,
|
||||||
value: _privacySettingsViewModel.shouldSaveRecipientAddress,
|
value: _privacySettingsViewModel.shouldSaveRecipientAddress,
|
||||||
onValueChange: (BuildContext _, bool value) {
|
onValueChange: (BuildContext _, bool value) {
|
||||||
_privacySettingsViewModel.setShouldSaveRecipientAddress(value);
|
_privacySettingsViewModel.setShouldSaveRecipientAddress(value);
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,9 @@ part 'display_settings_view_model.g.dart';
|
||||||
|
|
||||||
class DisplaySettingsViewModel = DisplaySettingsViewModelBase with _$DisplaySettingsViewModel;
|
class DisplaySettingsViewModel = DisplaySettingsViewModelBase with _$DisplaySettingsViewModel;
|
||||||
|
|
||||||
|
|
||||||
abstract class DisplaySettingsViewModelBase with Store {
|
abstract class DisplaySettingsViewModelBase with Store {
|
||||||
DisplaySettingsViewModelBase(
|
DisplaySettingsViewModelBase(
|
||||||
this._settingsStore,
|
this._settingsStore,
|
||||||
);
|
);
|
||||||
|
|
||||||
final SettingsStore _settingsStore;
|
final SettingsStore _settingsStore;
|
||||||
|
@ -22,10 +21,8 @@ abstract class DisplaySettingsViewModelBase with Store {
|
||||||
@computed
|
@computed
|
||||||
String get languageCode => _settingsStore.languageCode;
|
String get languageCode => _settingsStore.languageCode;
|
||||||
|
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
BalanceDisplayMode get balanceDisplayMode =>
|
BalanceDisplayMode get balanceDisplayMode => _settingsStore.balanceDisplayMode;
|
||||||
_settingsStore.balanceDisplayMode;
|
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
bool get shouldDisplayBalance => balanceDisplayMode == BalanceDisplayMode.displayableBalance;
|
bool get shouldDisplayBalance => balanceDisplayMode == BalanceDisplayMode.displayableBalance;
|
||||||
|
@ -34,30 +31,27 @@ abstract class DisplaySettingsViewModelBase with Store {
|
||||||
ThemeBase get theme => _settingsStore.currentTheme;
|
ThemeBase get theme => _settingsStore.currentTheme;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setBalanceDisplayMode(BalanceDisplayMode value) =>
|
void setBalanceDisplayMode(BalanceDisplayMode value) => _settingsStore.balanceDisplayMode = value;
|
||||||
_settingsStore.balanceDisplayMode = value;
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setShouldDisplayBalance(bool value){
|
void setShouldDisplayBalance(bool value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
_settingsStore.balanceDisplayMode = BalanceDisplayMode.displayableBalance;
|
_settingsStore.balanceDisplayMode = BalanceDisplayMode.displayableBalance;
|
||||||
} else {
|
} else {
|
||||||
_settingsStore.balanceDisplayMode = BalanceDisplayMode.hiddenBalance;
|
_settingsStore.balanceDisplayMode = BalanceDisplayMode.hiddenBalance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void onLanguageSelected (String code) {
|
void onLanguageSelected(String code) {
|
||||||
_settingsStore.languageCode = code;
|
_settingsStore.languageCode = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setTheme(ThemeBase newTheme){
|
void setTheme(ThemeBase newTheme) {
|
||||||
_settingsStore.currentTheme = newTheme;
|
_settingsStore.currentTheme = newTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setFiatCurrency(FiatCurrency value) =>
|
void setFiatCurrency(FiatCurrency value) => _settingsStore.fiatCurrency = value;
|
||||||
_settingsStore.fiatCurrency = value;
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,32 +12,26 @@ import 'package:package_info/package_info.dart';
|
||||||
|
|
||||||
part 'other_settings_view_model.g.dart';
|
part 'other_settings_view_model.g.dart';
|
||||||
|
|
||||||
class OtherSettingsViewModel = OtherSettingsViewModelBase
|
class OtherSettingsViewModel = OtherSettingsViewModelBase with _$OtherSettingsViewModel;
|
||||||
with _$OtherSettingsViewModel;
|
|
||||||
|
|
||||||
|
|
||||||
abstract class OtherSettingsViewModelBase with Store {
|
abstract class OtherSettingsViewModelBase with Store {
|
||||||
OtherSettingsViewModelBase(this._settingsStore, WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
|
OtherSettingsViewModelBase(
|
||||||
TransactionInfo>
|
this._settingsStore, WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> wallet)
|
||||||
wallet):
|
: walletType = wallet.type,
|
||||||
walletType = wallet.type,
|
_wallet = wallet,
|
||||||
_wallet = wallet,
|
currentVersion = '' {
|
||||||
currentVersion = ''{
|
PackageInfo.fromPlatform().then((PackageInfo packageInfo) => currentVersion = packageInfo.version);
|
||||||
PackageInfo.fromPlatform().then(
|
|
||||||
(PackageInfo packageInfo) => currentVersion = packageInfo.version);
|
|
||||||
|
|
||||||
final priority = _settingsStore.priority[wallet.type];
|
final priority = _settingsStore.priority[wallet.type];
|
||||||
final priorities = priorityForWalletType(wallet.type);
|
final priorities = priorityForWalletType(wallet.type);
|
||||||
|
|
||||||
if (!priorities.contains(priority)) {
|
if (!priorities.contains(priority)) {
|
||||||
_settingsStore.priority[wallet.type] = priorities.first;
|
_settingsStore.priority[wallet.type] = priorities.first;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
final WalletType walletType;
|
||||||
|
final WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> _wallet;
|
||||||
final WalletType walletType;
|
|
||||||
final WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
|
|
||||||
TransactionInfo> _wallet;
|
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
String currentVersion;
|
String currentVersion;
|
||||||
|
@ -55,11 +49,10 @@ abstract class OtherSettingsViewModelBase with Store {
|
||||||
return priority;
|
return priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getDisplayPriority(dynamic priority) {
|
String getDisplayPriority(dynamic priority) {
|
||||||
final _priority = priority as TransactionPriority;
|
final _priority = priority as TransactionPriority;
|
||||||
|
|
||||||
if (_wallet.type == WalletType.bitcoin
|
if (_wallet.type == WalletType.bitcoin || _wallet.type == WalletType.litecoin) {
|
||||||
|| _wallet.type == WalletType.litecoin) {
|
|
||||||
final rate = bitcoin!.getFeeRate(_wallet, _priority);
|
final rate = bitcoin!.getFeeRate(_wallet, _priority);
|
||||||
return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate);
|
return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate);
|
||||||
}
|
}
|
||||||
|
@ -67,6 +60,5 @@ abstract class OtherSettingsViewModelBase with Store {
|
||||||
return priority.toString();
|
return priority.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDisplayPrioritySelected(TransactionPriority priority) =>
|
void onDisplayPrioritySelected(TransactionPriority priority) => _settingsStore.priority[_wallet.type] = priority;
|
||||||
_settingsStore.priority[_wallet.type] = priority;
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -3,8 +3,7 @@ import 'package:mobx/mobx.dart';
|
||||||
|
|
||||||
part 'privacy_settings_view_model.g.dart';
|
part 'privacy_settings_view_model.g.dart';
|
||||||
|
|
||||||
class PrivacySettingsViewModel = PrivacySettingsViewModelBase
|
class PrivacySettingsViewModel = PrivacySettingsViewModelBase with _$PrivacySettingsViewModel;
|
||||||
with _$PrivacySettingsViewModel;
|
|
||||||
|
|
||||||
abstract class PrivacySettingsViewModelBase with Store {
|
abstract class PrivacySettingsViewModelBase with Store {
|
||||||
PrivacySettingsViewModelBase(this._settingsStore);
|
PrivacySettingsViewModelBase(this._settingsStore);
|
||||||
|
@ -15,14 +14,11 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||||
bool get disableExchange => _settingsStore.disableExchange;
|
bool get disableExchange => _settingsStore.disableExchange;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
bool get shouldSaveRecipientAddress =>
|
bool get shouldSaveRecipientAddress => _settingsStore.shouldSaveRecipientAddress;
|
||||||
_settingsStore.shouldSaveRecipientAddress;
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setShouldSaveRecipientAddress(bool value) =>
|
void setShouldSaveRecipientAddress(bool value) => _settingsStore.shouldSaveRecipientAddress = value;
|
||||||
_settingsStore.shouldSaveRecipientAddress = value;
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setEnableExchange(bool value) =>
|
void setEnableExchange(bool value) => _settingsStore.disableExchange = value;
|
||||||
_settingsStore.disableExchange = value;
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -4,26 +4,22 @@ import 'package:mobx/mobx.dart';
|
||||||
|
|
||||||
part 'security_settings_view_model.g.dart';
|
part 'security_settings_view_model.g.dart';
|
||||||
|
|
||||||
class SecuritySettingsViewModel = SecuritySettingsViewModelBase
|
class SecuritySettingsViewModel = SecuritySettingsViewModelBase with _$SecuritySettingsViewModel;
|
||||||
with _$SecuritySettingsViewModel;
|
|
||||||
|
|
||||||
abstract class SecuritySettingsViewModelBase with Store {
|
abstract class SecuritySettingsViewModelBase with Store {
|
||||||
SecuritySettingsViewModelBase(this._settingsStore): _biometricAuth = BiometricAuth();
|
SecuritySettingsViewModelBase(this._settingsStore) : _biometricAuth = BiometricAuth();
|
||||||
|
|
||||||
final BiometricAuth _biometricAuth;
|
final BiometricAuth _biometricAuth;
|
||||||
final SettingsStore _settingsStore;
|
final SettingsStore _settingsStore;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
bool get allowBiometricalAuthentication =>
|
bool get allowBiometricalAuthentication => _settingsStore.allowBiometricalAuthentication;
|
||||||
_settingsStore.allowBiometricalAuthentication;
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
Future<bool> biometricAuthenticated()async{
|
Future<bool> biometricAuthenticated() async {
|
||||||
return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated();
|
return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setAllowBiometricalAuthentication(bool value) =>
|
void setAllowBiometricalAuthentication(bool value) => _settingsStore.allowBiometricalAuthentication = value;
|
||||||
_settingsStore.allowBiometricalAuthentication = value;
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue