From c67e8c5037e4aafea5da830db30dd68a5dd85b89 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Fri, 18 Nov 2022 20:53:35 +0200 Subject: [PATCH] [CW-233] Fix missing display balance setting --- lib/di.dart | 8 ++++---- lib/router.dart | 8 ++++---- lib/src/screens/dashboard/dashboard_page.dart | 2 +- lib/src/screens/settings/display_settings_page.dart | 10 +++++----- lib/src/screens/settings/other_settings_page.dart | 2 +- lib/view_model/settings/settings_view_model.dart | 12 ++++++++++++ 6 files changed, 27 insertions(+), 15 deletions(-) diff --git a/lib/di.dart b/lib/di.dart index 265a5036b..815a3740e 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -5,10 +5,10 @@ import 'package:cake_wallet/ionia/ionia_anypay.dart'; import 'package:cake_wallet/ionia/ionia_gift_card.dart'; import 'package:cake_wallet/ionia/ionia_tip.dart'; import 'package:cake_wallet/src/screens/buy/onramper_page.dart'; -import 'package:cake_wallet/src/screens/setting/display_settings_page.dart'; -import 'package:cake_wallet/src/screens/setting/other_settings_page.dart'; -import 'package:cake_wallet/src/screens/setting/privacy_page.dart'; -import 'package:cake_wallet/src/screens/setting/security_backup_page.dart'; +import 'package:cake_wallet/src/screens/settings/display_settings_page.dart'; +import 'package:cake_wallet/src/screens/settings/other_settings_page.dart'; +import 'package:cake_wallet/src/screens/settings/privacy_page.dart'; +import 'package:cake_wallet/src/screens/settings/security_backup_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_custom_redeem_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_gift_card_detail_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_more_options_page.dart'; diff --git a/lib/router.dart b/lib/router.dart index e35ba19ef..7818cc52f 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -5,10 +5,10 @@ import 'package:cake_wallet/src/screens/backup/edit_backup_password_page.dart'; import 'package:cake_wallet/src/screens/buy/buy_webview_page.dart'; import 'package:cake_wallet/src/screens/buy/onramper_page.dart'; import 'package:cake_wallet/src/screens/buy/pre_order_page.dart'; -import 'package:cake_wallet/src/screens/setting/display_settings_page.dart'; -import 'package:cake_wallet/src/screens/setting/other_settings_page.dart'; -import 'package:cake_wallet/src/screens/setting/privacy_page.dart'; -import 'package:cake_wallet/src/screens/setting/security_backup_page.dart'; +import 'package:cake_wallet/src/screens/settings/display_settings_page.dart'; +import 'package:cake_wallet/src/screens/settings/other_settings_page.dart'; +import 'package:cake_wallet/src/screens/settings/privacy_page.dart'; +import 'package:cake_wallet/src/screens/settings/security_backup_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_account_cards_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_account_page.dart'; import 'package:cake_wallet/src/screens/ionia/cards/ionia_custom_redeem_page.dart'; diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index f3d5a21fb..cb90bb8e0 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -60,7 +60,7 @@ class DashboardPage extends BasePage { Widget middle(BuildContext context) { return SyncIndicator(dashboardViewModel: walletViewModel, onTap: () => Navigator.of(context, rootNavigator: true) - .pushNamed(Routes.nodeList)); + .pushNamed(Routes.connectionSync)); } @override diff --git a/lib/src/screens/settings/display_settings_page.dart b/lib/src/screens/settings/display_settings_page.dart index a5a855b59..0c18ce09a 100644 --- a/lib/src/screens/settings/display_settings_page.dart +++ b/lib/src/screens/settings/display_settings_page.dart @@ -29,11 +29,11 @@ class DisplaySettingsPage extends BasePage { child: Column( children: [ SettingsSwitcherCell( - title: S.current.settings_save_recipient_address, - value: settingsViewModel.shouldSaveRecipientAddress, - onValueChange: (BuildContext _, bool value) { - settingsViewModel.setShouldSaveRecipientAddress(value); - }), + title: S.current.settings_display_balance, + value: settingsViewModel.shouldDisplayBalance, + onValueChange: (_, bool value) { + settingsViewModel.setShouldDisplayBalance(value); + }), if (!isHaven) SettingsPickerCell( title: S.current.settings_currency, diff --git a/lib/src/screens/settings/other_settings_page.dart b/lib/src/screens/settings/other_settings_page.dart index 7d1ec311d..65d976708 100644 --- a/lib/src/screens/settings/other_settings_page.dart +++ b/lib/src/screens/settings/other_settings_page.dart @@ -24,7 +24,7 @@ class OtherSettingsPage extends BasePage { return Container( padding: EdgeInsets.only(top: 10), child: Column(children: [ - SettingsPickerCell( + SettingsPickerCell( title: S.current.settings_fee_priority, items: priorityForWalletType(_settingsViewModel.walletType), displayItem: _settingsViewModel.getDisplayPriority, diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index 359ebfaf5..9caacb211 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -116,6 +116,9 @@ abstract class SettingsViewModelBase with Store { BalanceDisplayMode get balanceDisplayMode => _settingsStore.balanceDisplayMode; + @computed + bool get shouldDisplayBalance => balanceDisplayMode == BalanceDisplayMode.displayableBalance; + @computed bool get shouldSaveRecipientAddress => _settingsStore.shouldSaveRecipientAddress; @@ -195,6 +198,15 @@ abstract class SettingsViewModelBase with Store { _settingsStore.currentTheme = newTheme; } + @action + void setShouldDisplayBalance(bool value){ + if (value) { + _settingsStore.balanceDisplayMode = BalanceDisplayMode.displayableBalance; + } else { + _settingsStore.balanceDisplayMode = BalanceDisplayMode.hiddenBalance; + } + } + String getDisplayPriority(dynamic priority) { final _priority = priority as TransactionPriority;