[skip ci] format files
Godwin Asuquo committed
Dec 1, 2022 at 21:21 UTC
03748d680ad7eedce158962581cfd17cd57bed8b
5 files changed
+58
-80
lib/src/screens/settings/privacy_page.dart
+18
-18
@@ -19,24 +19,24 @@ class PrivacyPage extends BasePage {
19
padding: EdgeInsets.only(top: 10),
20
child: Observer(builder: (_) {
21
return Observer(builder: (_) {
22
- return Column(
23
- mainAxisSize: MainAxisSize.min,
24
- children: [
25
- SettingsSwitcherCell(
26
- title: S.current.disable_exchange,
27
- value: _privacySettingsViewModel.disableExchange,
28
- onValueChange: (BuildContext context, bool value) {
29
- _privacySettingsViewModel.setEnableExchange(value);
30
- }),
31
- SettingsSwitcherCell(
32
- title: S.current.settings_save_recipient_address,
33
- value: _privacySettingsViewModel.shouldSaveRecipientAddress,
34
- onValueChange: (BuildContext _, bool value) {
35
- _privacySettingsViewModel.setShouldSaveRecipientAddress(value);
36
- })
37
- ],
38
- );
39
- });
22
+ return Column(
23
+ mainAxisSize: MainAxisSize.min,
24
+ children: [
25
+ SettingsSwitcherCell(
26
+ title: S.current.disable_exchange,
27
+ value: _privacySettingsViewModel.disableExchange,
28
+ onValueChange: (BuildContext context, bool value) {
29
+ _privacySettingsViewModel.setEnableExchange(value);
30
+ }),
31
+ SettingsSwitcherCell(
32
+ title: S.current.settings_save_recipient_address,
33
+ value: _privacySettingsViewModel.shouldSaveRecipientAddress,
34
+ onValueChange: (BuildContext _, bool value) {
35
+ _privacySettingsViewModel.setShouldSaveRecipientAddress(value);
36
+ })
37
+ ],
38
+ );
39
+ });
40
}),
41
);
42
}
lib/view_model/settings/display_settings_view_model.dart
+12
-18
@@ -8,10 +8,9 @@ part 'display_settings_view_model.g.dart';
8
9
class DisplaySettingsViewModel = DisplaySettingsViewModelBase with _$DisplaySettingsViewModel;
10
11
-
11
abstract class DisplaySettingsViewModelBase with Store {
12
DisplaySettingsViewModelBase(
14
- this._settingsStore,
13
+ this._settingsStore,
14
);
15
16
final SettingsStore _settingsStore;
@@ -22,10 +21,8 @@ abstract class DisplaySettingsViewModelBase with Store {
21
@computed
22
String get languageCode => _settingsStore.languageCode;
23
25
-
24
@computed
27
- BalanceDisplayMode get balanceDisplayMode =>
28
- _settingsStore.balanceDisplayMode;
25
+ BalanceDisplayMode get balanceDisplayMode => _settingsStore.balanceDisplayMode;
26
27
@computed
28
bool get shouldDisplayBalance => balanceDisplayMode == BalanceDisplayMode.displayableBalance;
@@ -34,30 +31,27 @@ abstract class DisplaySettingsViewModelBase with Store {
31
ThemeBase get theme => _settingsStore.currentTheme;
32
33
@action
37
- void setBalanceDisplayMode(BalanceDisplayMode value) =>
38
- _settingsStore.balanceDisplayMode = value;
34
+ void setBalanceDisplayMode(BalanceDisplayMode value) => _settingsStore.balanceDisplayMode = value;
35
36
@action
41
- void setShouldDisplayBalance(bool value){
42
- if (value) {
43
- _settingsStore.balanceDisplayMode = BalanceDisplayMode.displayableBalance;
37
+ void setShouldDisplayBalance(bool value) {
38
+ if (value) {
39
+ _settingsStore.balanceDisplayMode = BalanceDisplayMode.displayableBalance;
40
} else {
45
- _settingsStore.balanceDisplayMode = BalanceDisplayMode.hiddenBalance;
41
+ _settingsStore.balanceDisplayMode = BalanceDisplayMode.hiddenBalance;
42
}
43
}
44
45
@action
50
- void onLanguageSelected (String code) {
46
+ void onLanguageSelected(String code) {
47
_settingsStore.languageCode = code;
48
}
49
50
@action
55
- void setTheme(ThemeBase newTheme){
56
- _settingsStore.currentTheme = newTheme;
51
+ void setTheme(ThemeBase newTheme) {
52
+ _settingsStore.currentTheme = newTheme;
53
}
54
55
@action
60
- void setFiatCurrency(FiatCurrency value) =>
61
- _settingsStore.fiatCurrency = value;
62
-
63
-}
\ No newline at end of file
56
+ void setFiatCurrency(FiatCurrency value) => _settingsStore.fiatCurrency = value;
57
+}
lib/view_model/settings/other_settings_view_model.dart
+14
-22
@@ -12,32 +12,26 @@ import 'package:package_info/package_info.dart';
12
13
part 'other_settings_view_model.g.dart';
14
15
-class OtherSettingsViewModel = OtherSettingsViewModelBase
16
- with _$OtherSettingsViewModel;
17
-
15
+class OtherSettingsViewModel = OtherSettingsViewModelBase with _$OtherSettingsViewModel;
16
17
abstract class OtherSettingsViewModelBase with Store {
20
- OtherSettingsViewModelBase(this._settingsStore, WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
21
- TransactionInfo>
22
- wallet):
23
- walletType = wallet.type,
24
- _wallet = wallet,
25
- currentVersion = ''{
26
- PackageInfo.fromPlatform().then(
27
- (PackageInfo packageInfo) => currentVersion = packageInfo.version);
18
+ OtherSettingsViewModelBase(
19
+ this._settingsStore, WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> wallet)
20
+ : walletType = wallet.type,
21
+ _wallet = wallet,
22
+ currentVersion = '' {
23
+ PackageInfo.fromPlatform().then((PackageInfo packageInfo) => currentVersion = packageInfo.version);
24
25
final priority = _settingsStore.priority[wallet.type];
26
final priorities = priorityForWalletType(wallet.type);
27
28
if (!priorities.contains(priority)) {
29
_settingsStore.priority[wallet.type] = priorities.first;
30
+ }
31
}
32
36
- }
37
-
38
- final WalletType walletType;
39
- final WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
40
- TransactionInfo> _wallet;
33
+ final WalletType walletType;
34
+ final WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> _wallet;
35
36
@observable
37
String currentVersion;
@@ -55,11 +49,10 @@ abstract class OtherSettingsViewModelBase with Store {
49
return priority;
50
}
51
58
- String getDisplayPriority(dynamic priority) {
52
+ String getDisplayPriority(dynamic priority) {
53
final _priority = priority as TransactionPriority;
54
61
- if (_wallet.type == WalletType.bitcoin
62
- || _wallet.type == WalletType.litecoin) {
55
+ if (_wallet.type == WalletType.bitcoin || _wallet.type == WalletType.litecoin) {
56
final rate = bitcoin!.getFeeRate(_wallet, _priority);
57
return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate);
58
}
@@ -67,6 +60,5 @@ abstract class OtherSettingsViewModelBase with Store {
60
return priority.toString();
61
}
62
70
- void onDisplayPrioritySelected(TransactionPriority priority) =>
71
- _settingsStore.priority[_wallet.type] = priority;
72
-}
\ No newline at end of file
63
+ void onDisplayPrioritySelected(TransactionPriority priority) => _settingsStore.priority[_wallet.type] = priority;
64
+}
lib/view_model/settings/privacy_settings_view_model.dart
+6
-10
@@ -3,8 +3,7 @@ import 'package:mobx/mobx.dart';
3
4
part 'privacy_settings_view_model.g.dart';
5
6
-class PrivacySettingsViewModel = PrivacySettingsViewModelBase
7
- with _$PrivacySettingsViewModel;
6
+class PrivacySettingsViewModel = PrivacySettingsViewModelBase with _$PrivacySettingsViewModel;
7
8
abstract class PrivacySettingsViewModelBase with Store {
9
PrivacySettingsViewModelBase(this._settingsStore);
@@ -15,14 +14,11 @@ abstract class PrivacySettingsViewModelBase with Store {
14
bool get disableExchange => _settingsStore.disableExchange;
15
16
@computed
18
- bool get shouldSaveRecipientAddress =>
19
- _settingsStore.shouldSaveRecipientAddress;
17
+ bool get shouldSaveRecipientAddress => _settingsStore.shouldSaveRecipientAddress;
18
19
@action
22
- void setShouldSaveRecipientAddress(bool value) =>
23
- _settingsStore.shouldSaveRecipientAddress = value;
24
-
20
+ void setShouldSaveRecipientAddress(bool value) => _settingsStore.shouldSaveRecipientAddress = value;
21
+
22
@action
26
- void setEnableExchange(bool value) =>
27
- _settingsStore.disableExchange = value;
28
-}
\ No newline at end of file
23
+ void setEnableExchange(bool value) => _settingsStore.disableExchange = value;
24
+}
lib/view_model/settings/security_settings_view_model.dart
+8
-12
@@ -4,26 +4,22 @@ import 'package:mobx/mobx.dart';
4
5
part 'security_settings_view_model.g.dart';
6
7
-class SecuritySettingsViewModel = SecuritySettingsViewModelBase
8
- with _$SecuritySettingsViewModel;
7
+class SecuritySettingsViewModel = SecuritySettingsViewModelBase with _$SecuritySettingsViewModel;
8
9
abstract class SecuritySettingsViewModelBase with Store {
11
- SecuritySettingsViewModelBase(this._settingsStore): _biometricAuth = BiometricAuth();
10
+ SecuritySettingsViewModelBase(this._settingsStore) : _biometricAuth = BiometricAuth();
11
12
final BiometricAuth _biometricAuth;
13
final SettingsStore _settingsStore;
15
-
14
+
15
@computed
17
- bool get allowBiometricalAuthentication =>
18
- _settingsStore.allowBiometricalAuthentication;
16
+ bool get allowBiometricalAuthentication => _settingsStore.allowBiometricalAuthentication;
17
18
@action
21
- Future<bool> biometricAuthenticated()async{
22
- return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated();
19
+ Future<bool> biometricAuthenticated() async {
20
+ return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated();
21
}
22
23
@action
26
- void setAllowBiometricalAuthentication(bool value) =>
27
- _settingsStore.allowBiometricalAuthentication = value;
28
-
29
-}
\ No newline at end of file
24
+ void setAllowBiometricalAuthentication(bool value) => _settingsStore.allowBiometricalAuthentication = value;
25
+}