Fix issues from code review
Godwin Asuquo committed
Nov 25, 2022 at 22:51 UTC
3acbfbae796e16aa5a613a55f19dfe4815277665
10 files changed
+94
-192
lib/di.dart
+5
-18
@@ -123,7 +123,6 @@ import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_v
123
import 'package:cake_wallet/view_model/monero_account_list/monero_account_edit_or_create_view_model.dart';
124
import 'package:cake_wallet/view_model/monero_account_list/monero_account_list_view_model.dart';
125
import 'package:cake_wallet/view_model/send/send_view_model.dart';
126
-import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
126
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
127
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
128
import 'package:cake_wallet/view_model/wallet_restore_view_model.dart';
@@ -385,8 +384,7 @@ Future setup(
384
_transactionDescriptionBox));
385
386
getIt.registerFactory(
388
- () => SendPage(sendViewModel: getIt.get<SendViewModel>(),
389
- settingsViewModel: getIt.get<SettingsViewModel>()));
387
+ () => SendPage(sendViewModel: getIt.get<SendViewModel>()));
388
389
getIt.registerFactory(() => SendTemplatePage(
390
sendTemplateViewModel: getIt.get<SendTemplateViewModel>()));
@@ -442,29 +440,19 @@ Future setup(
440
getIt.get<MoneroAccountEditOrCreateViewModel>(param1: account)));
441
442
getIt.registerFactory(() {
445
- final appStore = getIt.get<AppStore>();
446
- final yatStore = getIt.get<YatStore>();
447
- return SettingsViewModel(appStore.settingsStore, yatStore, appStore.wallet!);
448
- });
449
-
450
- getIt.registerFactory(() {
451
- final appStore = getIt.get<AppStore>();
452
- return DisplaySettingsViewModel(appStore.settingsStore);
443
+ return DisplaySettingsViewModel(getIt.get<SettingsStore>());
444
});
445
446
getIt.registerFactory(() {
456
- final appStore = getIt.get<AppStore>();
457
- return PrivacySettingsViewModel(appStore.settingsStore);
447
+ return PrivacySettingsViewModel(getIt.get<SettingsStore>());
448
});
449
450
getIt.registerFactory(() {
461
- final appStore = getIt.get<AppStore>();
462
- return OtherSettingsViewModel(appStore.settingsStore, appStore.wallet!);
451
+ return OtherSettingsViewModel(getIt(), getIt());
452
});
453
454
getIt.registerFactory(() {
466
- final appStore = getIt.get<AppStore>();
467
- return SecuritySettingsViewModel(appStore.settingsStore);
455
+ return SecuritySettingsViewModel(getIt.get<SettingsStore>());
456
});
457
458
getIt
@@ -530,7 +518,6 @@ Future setup(
518
getIt.get<TradesStore>(),
519
getIt.get<AppStore>().settingsStore,
520
getIt.get<SharedPreferences>(),
533
- getIt.get<SettingsViewModel>(),
521
));
522
523
getIt.registerFactory(() => ExchangeTradeViewModel(
lib/src/screens/send/send_page.dart
+3
-8
@@ -1,4 +1,3 @@
1
-import 'dart:ui';
1
import 'package:cake_wallet/entities/fiat_currency.dart';
2
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator_icon.dart';
3
import 'package:cake_wallet/src/screens/send/widgets/send_card.dart';
@@ -6,8 +5,6 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
5
import 'package:cake_wallet/src/widgets/picker.dart';
6
import 'package:cake_wallet/src/widgets/template_tile.dart';
7
import 'package:cake_wallet/view_model/send/output.dart';
9
-import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
10
-import 'package:flutter/cupertino.dart';
8
import 'package:flutter/material.dart';
9
import 'package:flutter_mobx/flutter_mobx.dart';
10
import 'package:mobx/mobx.dart';
@@ -28,13 +25,11 @@ import 'package:smooth_page_indicator/smooth_page_indicator.dart';
25
import 'package:cw_core/crypto_currency.dart';
26
27
class SendPage extends BasePage {
31
- SendPage({required this.sendViewModel,required this.settingsViewModel }) : _formKey = GlobalKey<FormState>(),fiatFromSettings = settingsViewModel.fiatCurrency;
28
+ SendPage({required this.sendViewModel}) : _formKey = GlobalKey<FormState>();
29
30
final SendViewModel sendViewModel;
34
- final SettingsViewModel settingsViewModel;
31
final GlobalKey<FormState> _formKey;
32
final controller = PageController(initialPage: 0);
37
- final FiatCurrency fiatFromSettings ;
33
34
bool _effectsInstalled = false;
35
@@ -55,7 +50,7 @@ class SendPage extends BasePage {
50
51
@override
52
void onClose(BuildContext context) {
58
- settingsViewModel.setFiatCurrency(fiatFromSettings);
53
+ sendViewModel.onClose();
54
Navigator.of(context).pop();
55
}
56
@@ -236,7 +231,7 @@ class SendPage extends BasePage {
231
if(template.isCurrencySelected){
232
output.setCryptoAmount(template.amount);
233
}else{
239
- settingsViewModel.setFiatCurrency(fiatFromTemplate);
234
+ sendViewModel.setFiatCurrency(fiatFromTemplate);
235
output.setFiatAmount(template.amountFiat);
236
}
237
output.resetParsedAddress();
lib/src/screens/settings/display_settings_page.dart
+10
-10
@@ -14,12 +14,12 @@ import 'package:flutter/material.dart';
14
import 'package:flutter_mobx/flutter_mobx.dart';
15
16
class DisplaySettingsPage extends BasePage {
17
- DisplaySettingsPage(this.settingsViewModel);
17
+ DisplaySettingsPage(this._displaySettingsViewModel);
18
19
@override
20
String get title => S.current.display_settings;
21
22
- final DisplaySettingsViewModel settingsViewModel;
22
+ final DisplaySettingsViewModel _displaySettingsViewModel;
23
24
@override
25
Widget body(BuildContext context) {
@@ -30,17 +30,17 @@ class DisplaySettingsPage extends BasePage {
30
children: [
31
SettingsSwitcherCell(
32
title: S.current.settings_display_balance,
33
- value: settingsViewModel.shouldDisplayBalance,
33
+ value: _displaySettingsViewModel.shouldDisplayBalance,
34
onValueChange: (_, bool value) {
35
- settingsViewModel.setShouldDisplayBalance(value);
35
+ _displaySettingsViewModel.setShouldDisplayBalance(value);
36
}),
37
if (!isHaven)
38
SettingsPickerCell<FiatCurrency>(
39
title: S.current.settings_currency,
40
searchHintText: S.current.search_currency,
41
items: FiatCurrency.all,
42
- selectedItem: settingsViewModel.fiatCurrency,
43
- onItemSelected: (FiatCurrency currency) => settingsViewModel.setFiatCurrency(currency),
42
+ selectedItem: _displaySettingsViewModel.fiatCurrency,
43
+ onItemSelected: (FiatCurrency currency) => _displaySettingsViewModel.setFiatCurrency(currency),
44
images: FiatCurrency.all.map((e) => Image.asset("assets/images/flags/${e.countryCode}.png")).toList(),
45
isGridView: true,
46
matchingCriteria: (FiatCurrency currency, String searchText) {
@@ -55,8 +55,8 @@ class DisplaySettingsPage extends BasePage {
55
displayItem: (dynamic code) {
56
return LanguageService.list[code] ?? '';
57
},
58
- selectedItem: settingsViewModel.languageCode,
59
- onItemSelected: settingsViewModel.onLanguageSelected,
58
+ selectedItem: _displaySettingsViewModel.languageCode,
59
+ onItemSelected: _displaySettingsViewModel.onLanguageSelected,
60
images: LanguageService.list.keys
61
.map((e) => Image.asset("assets/images/flags/${LanguageService.localeCountryCode[e]}.png"))
62
.toList(),
@@ -68,8 +68,8 @@ class DisplaySettingsPage extends BasePage {
68
ChoicesListItem<ThemeBase>(
69
title: S.current.color_theme,
70
items: ThemeList.all,
71
- selectedItem: settingsViewModel.theme,
72
- onItemSelected: (ThemeBase theme) => settingsViewModel.setTheme(theme),
71
+ selectedItem: _displaySettingsViewModel.theme,
72
+ onItemSelected: (ThemeBase theme) => _displaySettingsViewModel.setTheme(theme),
73
),
74
),
75
],
lib/src/screens/settings/other_settings_page.dart
+7
-7
@@ -11,12 +11,12 @@ import 'package:flutter/material.dart';
11
import 'package:flutter_mobx/flutter_mobx.dart';
12
13
class OtherSettingsPage extends BasePage {
14
- OtherSettingsPage(this._settingsViewModel);
14
+ OtherSettingsPage(this._otherSettingsViewModel);
15
16
@override
17
String get title => S.current.other_settings;
18
19
- final OtherSettingsViewModel _settingsViewModel;
19
+ final OtherSettingsViewModel _otherSettingsViewModel;
20
21
@override
22
Widget body(BuildContext context) {
@@ -26,10 +26,10 @@ class OtherSettingsPage extends BasePage {
26
child: Column(children: [
27
SettingsPickerCell(
28
title: S.current.settings_fee_priority,
29
- items: priorityForWalletType(_settingsViewModel.walletType),
30
- displayItem: _settingsViewModel.getDisplayPriority,
31
- selectedItem: _settingsViewModel.transactionPriority,
32
- onItemSelected: _settingsViewModel.onDisplayPrioritySelected,
29
+ items: priorityForWalletType(_otherSettingsViewModel.walletType),
30
+ displayItem: _otherSettingsViewModel.getDisplayPriority,
31
+ selectedItem: _otherSettingsViewModel.transactionPriority,
32
+ onItemSelected: _otherSettingsViewModel.onDisplayPrioritySelected,
33
),
34
SettingsCellWithArrow(
35
title: S.current.settings_terms_and_conditions,
@@ -37,7 +37,7 @@ class OtherSettingsPage extends BasePage {
37
),
38
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
39
Spacer(),
40
- SettingsVersionCell(title: S.of(context).version(_settingsViewModel.currentVersion))
40
+ SettingsVersionCell(title: S.of(context).version(_otherSettingsViewModel.currentVersion))
41
]),
42
);
43
});
lib/src/screens/settings/privacy_page.dart
+19
-6
@@ -6,24 +6,37 @@ import 'package:flutter/material.dart';
6
import 'package:flutter_mobx/flutter_mobx.dart';
7
8
class PrivacyPage extends BasePage {
9
- PrivacyPage(this.settingsViewModel);
9
+ PrivacyPage(this._privacySettingsViewModel);
10
11
@override
12
String get title => S.current.privacy_settings;
13
14
- final PrivacySettingsViewModel settingsViewModel;
14
+ final PrivacySettingsViewModel _privacySettingsViewModel;
15
16
@override
17
Widget body(BuildContext context) {
18
return Container(
19
padding: EdgeInsets.only(top: 10),
20
child: Observer(builder: (_) {
21
- return SettingsSwitcherCell(
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,
23
- value: settingsViewModel.shouldSaveRecipientAddress,
33
+ value: _privacySettingsViewModel.shouldSaveRecipientAddress,
34
onValueChange: (BuildContext _, bool value) {
25
- settingsViewModel.setShouldSaveRecipientAddress(value);
26
- });
35
+ _privacySettingsViewModel.setShouldSaveRecipientAddress(value);
36
+ })
37
+ ],
38
+ );
39
+ });
40
}),
41
);
42
}
lib/src/screens/settings/security_backup_page.dart
+7
-8
@@ -7,17 +7,16 @@ import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arro
7
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
8
import 'package:cake_wallet/src/widgets/standard_list.dart';
9
import 'package:cake_wallet/view_model/settings/security_settings_view_model.dart';
10
-import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
10
import 'package:flutter/material.dart';
11
import 'package:flutter_mobx/flutter_mobx.dart';
12
13
class SecurityBackupPage extends BasePage {
15
- SecurityBackupPage(this.settingsViewModel);
14
+ SecurityBackupPage(this._securitySettingsViewModel);
15
16
@override
17
String get title => S.current.security_and_backup;
18
20
- final SecuritySettingsViewModel settingsViewModel;
19
+ final SecuritySettingsViewModel _securitySettingsViewModel;
20
21
@override
22
Widget body(BuildContext context) {
@@ -59,23 +58,23 @@ class SecurityBackupPage extends BasePage {
58
Observer(builder: (_) {
59
return SettingsSwitcherCell(
60
title: S.current.settings_allow_biometrical_authentication,
62
- value: settingsViewModel.allowBiometricalAuthentication,
61
+ value: _securitySettingsViewModel.allowBiometricalAuthentication,
62
onValueChange: (BuildContext context, bool value) {
63
if (value) {
64
Navigator.of(context).pushNamed(Routes.auth,
65
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
66
if (isAuthenticatedSuccessfully) {
68
- if (await settingsViewModel.biometricAuthenticated()) {
69
- settingsViewModel.setAllowBiometricalAuthentication(isAuthenticatedSuccessfully);
67
+ if (await _securitySettingsViewModel.biometricAuthenticated()) {
68
+ _securitySettingsViewModel.setAllowBiometricalAuthentication(isAuthenticatedSuccessfully);
69
}
70
} else {
72
- settingsViewModel.setAllowBiometricalAuthentication(isAuthenticatedSuccessfully);
71
+ _securitySettingsViewModel.setAllowBiometricalAuthentication(isAuthenticatedSuccessfully);
72
}
73
74
auth.close();
75
});
76
} else {
78
- settingsViewModel.setAllowBiometricalAuthentication(value);
77
+ _securitySettingsViewModel.setAllowBiometricalAuthentication(value);
78
}
79
});
80
}),
lib/view_model/exchange/exchange_view_model.dart
+18
-7
@@ -6,8 +6,8 @@ import 'package:cake_wallet/entities/preferences_key.dart';
6
import 'package:cake_wallet/exchange/sideshift/sideshift_exchange_provider.dart';
7
import 'package:cake_wallet/exchange/sideshift/sideshift_request.dart';
8
import 'package:cake_wallet/exchange/simpleswap/simpleswap_exchange_provider.dart';
9
-import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
9
import 'package:cake_wallet/exchange/simpleswap/simpleswap_request.dart';
10
+import 'package:cw_core/transaction_priority.dart';
11
import 'package:cw_core/wallet_base.dart';
12
import 'package:cw_core/crypto_currency.dart';
13
import 'package:cw_core/sync_status.dart';
@@ -42,7 +42,7 @@ class ExchangeViewModel = ExchangeViewModelBase with _$ExchangeViewModel;
42
43
abstract class ExchangeViewModelBase with Store {
44
ExchangeViewModelBase(this.wallet, this.trades, this._exchangeTemplateStore,
45
- this.tradesStore, this._settingsStore, this.sharedPreferences, this._settingsViewModel)
45
+ this.tradesStore, this._settingsStore, this.sharedPreferences)
46
: _cryptoNumberFormat = NumberFormat(),
47
isReverse = false,
48
isFixedRateMode = false,
@@ -189,6 +189,19 @@ abstract class ExchangeViewModelBase with Store {
189
ObservableList<ExchangeTemplate> get templates =>
190
_exchangeTemplateStore.templates;
191
192
+
193
+ @computed
194
+ TransactionPriority get transactionPriority {
195
+ final priority = _settingsStore.priority[wallet.type];
196
+
197
+ if (priority == null) {
198
+ throw Exception('Unexpected type ${wallet.type.toString()}');
199
+ }
200
+
201
+ return priority;
202
+ }
203
+
204
+
205
bool get hasAllAmount =>
206
wallet.type == WalletType.bitcoin && depositCurrency == wallet.currency;
207
@@ -198,11 +211,11 @@ abstract class ExchangeViewModelBase with Store {
211
switch (wallet.type) {
212
case WalletType.monero:
213
case WalletType.haven:
201
- return _settingsViewModel.transactionPriority == monero!.getMoneroTransactionPrioritySlow();
214
+ return transactionPriority == monero!.getMoneroTransactionPrioritySlow();
215
case WalletType.bitcoin:
203
- return _settingsViewModel.transactionPriority == bitcoin!.getBitcoinTransactionPrioritySlow();
216
+ return transactionPriority == bitcoin!.getBitcoinTransactionPrioritySlow();
217
case WalletType.litecoin:
205
- return _settingsViewModel.transactionPriority == bitcoin!.getLitecoinTransactionPrioritySlow();
218
+ return transactionPriority == bitcoin!.getLitecoinTransactionPrioritySlow();
219
default:
220
return false;
221
}
@@ -220,8 +233,6 @@ abstract class ExchangeViewModelBase with Store {
233
234
final SettingsStore _settingsStore;
235
223
- final SettingsViewModel _settingsViewModel;
224
-
236
double _bestRate = 0.0;
237
238
late Timer bestRateSync;
lib/view_model/send/send_view_model.dart
+18
-4
@@ -42,7 +42,8 @@ abstract class SendViewModelBase with Store {
42
: state = InitialExecutionState(),
43
currencies = _wallet.balance.keys.toList(),
44
selectedCryptoCurrency = _wallet.currency,
45
- outputs = ObservableList<Output>() {
45
+ outputs = ObservableList<Output>(),
46
+ fiatFromSettings = _settingsStore.fiatCurrency {
47
final priority = _settingsStore.priority[_wallet.type];
48
final priorities = priorityForWalletType(_wallet.type);
49
@@ -52,7 +53,7 @@ abstract class SendViewModelBase with Store {
53
54
outputs.add(Output(_wallet, _settingsStore, _fiatConversationStore, () => selectedCryptoCurrency));
55
}
55
-
56
+
57
@observable
58
ExecutionState state;
59
@@ -133,11 +134,13 @@ abstract class SendViewModelBase with Store {
134
135
Validator get textValidator => TextValidator();
136
137
+ final FiatCurrency fiatFromSettings;
138
+
139
@observable
140
PendingTransaction? pendingTransaction;
141
142
@computed
140
- String get balance => balanceViewModel.availableBalance ?? '0.0';
143
+ String get balance => balanceViewModel.availableBalance;
144
145
@computed
146
bool get isReadyForSend => _wallet.syncStatus is SyncedSyncStatus;
@@ -166,6 +169,9 @@ abstract class SendViewModelBase with Store {
169
170
bool get hasCurrecyChanger => walletType == WalletType.haven;
171
172
+ @computed
173
+ FiatCurrency get fiatCurrency => _settingsStore.fiatCurrency;
174
+
175
final WalletBase _wallet;
176
final SettingsStore _settingsStore;
177
final SendTemplateViewModel sendTemplateViewModel;
@@ -208,7 +214,7 @@ abstract class SendViewModelBase with Store {
214
state = TransactionCommitting();
215
await pendingTransaction!.commit();
216
211
- if (pendingTransaction!.id?.isNotEmpty ?? false) {
217
+ if (pendingTransaction!.id.isNotEmpty) {
218
_settingsStore.shouldSaveRecipientAddress
219
? await transactionDescriptionBox.add(TransactionDescription(
220
id: pendingTransaction!.id,
@@ -283,4 +289,12 @@ abstract class SendViewModelBase with Store {
289
290
bool _isEqualCurrency(String currency) =>
291
currency.toLowerCase() == _wallet.currency.title.toLowerCase();
292
+
293
+ @action
294
+ void onClose() =>
295
+ _settingsStore.fiatCurrency = fiatFromSettings;
296
+
297
+ @action
298
+ void setFiatCurrency(FiatCurrency fiat) =>
299
+ _settingsStore.fiatCurrency = fiat;
300
}
lib/view_model/settings/privacy_settings_view_model.dart
+7
@@ -11,6 +11,9 @@ abstract class PrivacySettingsViewModelBase with Store {
11
12
final SettingsStore _settingsStore;
13
14
+ @computed
15
+ bool get disableExchange => _settingsStore.disableExchange;
16
+
17
@computed
18
bool get shouldSaveRecipientAddress =>
19
_settingsStore.shouldSaveRecipientAddress;
@@ -18,4 +21,8 @@ abstract class PrivacySettingsViewModelBase with Store {
21
@action
22
void setShouldSaveRecipientAddress(bool value) =>
23
_settingsStore.shouldSaveRecipientAddress = value;
24
+
25
+ @action
26
+ void setEnableExchange(bool value) =>
27
+ _settingsStore.disableExchange = value;
28
}
\ No newline at end of file
lib/view_model/settings/settings_view_model.dart
deleted
-124
@@ -1,124 +0,0 @@
1
-import 'package:cake_wallet/entities/priority_for_wallet_type.dart';
2
-import 'package:cake_wallet/store/yat/yat_store.dart';
3
-import 'package:mobx/mobx.dart';
4
-import 'package:cw_core/wallet_base.dart';
5
-import 'package:cake_wallet/store/settings_store.dart';
6
-import 'package:cw_core/wallet_type.dart';
7
-import 'package:cake_wallet/entities/fiat_currency.dart';
8
-import 'package:cake_wallet/entities/action_list_display_mode.dart';
9
-import 'package:cw_core/transaction_history.dart';
10
-import 'package:cw_core/balance.dart';
11
-import 'package:cw_core/transaction_info.dart';
12
-import 'package:cw_core/transaction_priority.dart';
13
-import 'package:cake_wallet/themes/theme_base.dart';
14
-
15
-part 'settings_view_model.g.dart';
16
-
17
-class SettingsViewModel = SettingsViewModelBase with _$SettingsViewModel;
18
-
19
-abstract class SettingsViewModelBase with Store {
20
- SettingsViewModelBase(
21
- this._settingsStore,
22
- this._yatStore,
23
- WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
24
- TransactionInfo>
25
- wallet)
26
- : itemHeaders = {},
27
- walletType = wallet.type,
28
- _wallet = wallet{
29
-
30
- final priority = _settingsStore.priority[wallet.type];
31
- final priorities = priorityForWalletType(wallet.type);
32
-
33
- if (!priorities.contains(priority)) {
34
- _settingsStore.priority[wallet.type] = priorities.first;
35
- }
36
-
37
- //var connectYatUrl = YatLink.baseUrl + YatLink.signInSuffix;
38
- //final connectYatUrlParameters =
39
- // _yatStore.defineQueryParameters();
40
-
41
- //if (connectYatUrlParameters.isNotEmpty) {
42
- // connectYatUrl += YatLink.queryParameter + connectYatUrlParameters;
43
- //}
44
-
45
- //var manageYatUrl = YatLink.baseUrl + YatLink.managePath;
46
- //final manageYatUrlParameters =
47
- // _yatStore.defineQueryParameters();
48
-
49
- //if (manageYatUrlParameters.isNotEmpty) {
50
- // manageYatUrl += YatLink.queryParameter + manageYatUrlParameters;
51
- //}
52
-
53
- //var createNewYatUrl = YatLink.startFlowUrl;
54
- //final createNewYatUrlParameters =
55
- // _yatStore.defineQueryParameters();
56
-
57
- //if (createNewYatUrlParameters.isNotEmpty) {
58
- // createNewYatUrl += '?sub1=' + createNewYatUrlParameters;
59
- //}
60
-
61
- }
62
-
63
- @computed
64
- FiatCurrency get fiatCurrency => _settingsStore.fiatCurrency;
65
-
66
- @computed
67
- ObservableList<ActionListDisplayMode> get actionlistDisplayMode =>
68
- _settingsStore.actionlistDisplayMode;
69
-
70
- @computed
71
- TransactionPriority get transactionPriority {
72
- final priority = _settingsStore.priority[walletType];
73
-
74
- if (priority == null) {
75
- throw Exception('Unexpected type ${walletType.toString()}');
76
- }
77
-
78
- return priority;
79
- }
80
-
81
- @computed
82
- ThemeBase get theme => _settingsStore.currentTheme;
83
-
84
- bool get isBitcoinBuyEnabled => _settingsStore.isBitcoinBuyEnabled;
85
-
86
- final Map<String, String> itemHeaders;
87
- final SettingsStore _settingsStore;
88
- final YatStore _yatStore;
89
- final WalletType walletType;
90
- final WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
91
- TransactionInfo> _wallet;
92
-
93
- @action
94
- void setFiatCurrency(FiatCurrency value) =>
95
- _settingsStore.fiatCurrency = value;
96
-
97
- @action
98
- void toggleTransactionsDisplay() =>
99
- actionlistDisplayMode.contains(ActionListDisplayMode.transactions)
100
- ? _hideTransaction()
101
- : _showTransaction();
102
-
103
- @action
104
- void toggleTradesDisplay() =>
105
- actionlistDisplayMode.contains(ActionListDisplayMode.trades)
106
- ? _hideTrades()
107
- : _showTrades();
108
-
109
- @action
110
- void _hideTransaction() =>
111
- actionlistDisplayMode.remove(ActionListDisplayMode.transactions);
112
-
113
- @action
114
- void _hideTrades() =>
115
- actionlistDisplayMode.remove(ActionListDisplayMode.trades);
116
-
117
- @action
118
- void _showTransaction() =>
119
- actionlistDisplayMode.add(ActionListDisplayMode.transactions);
120
-
121
- @action
122
- void _showTrades() => actionlistDisplayMode.add(ActionListDisplayMode.trades);
123
-
124
-}