add balance hidden message (#3132)

* add balance hidden message

* add to translation

* add to translation
This commit is contained in:
malik1004x
2026-03-26 00:06:15 +01:00
committed by GitHub
parent 312d88dc63
commit cbc9f99ba4
35 changed files with 77 additions and 7 deletions
+1
View File
@@ -136,4 +136,5 @@ class PreferencesKey {
static const syncStatusDisplayMode = 'sync_status_display_mode';
static const backgroundImage = 'background_image';
static const mwebAdDismissed = "mweb_ad_dismissed";
static const balanceHideCounter = "balance_hide_counter";
}
+24 -1
View File
@@ -1,5 +1,6 @@
import 'package:cake_wallet/core/auth_service.dart';
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/modal_navigator.dart';
import 'package:cake_wallet/new-ui/pages/account_customizer.dart';
import 'package:cake_wallet/new-ui/pages/card_customizer.dart';
@@ -129,7 +130,29 @@ class _NewHomePageState extends State<NewHomePage> {
lightningMode: _lightningMode,
),
),
UnconfirmedBalanceWidget(dashboardViewModel: widget.dashboardViewModel,),
Observer(builder: (_) {
return AnimatedSize(
duration: Duration(milliseconds: 150),
curve: Curves.easeInOutCubic,
child: (widget.dashboardViewModel.shouldShowBalanceHiddenMessage)
? Column(
children: [
SizedBox(
height: 12,
width: double.infinity,
),
Text(
S.of(context).long_press_show_balance,
style: TextStyle(
color:
Theme.of(context).colorScheme.onSurfaceVariant),
)
],
)
: SizedBox(width: double.infinity),
);
}),
UnconfirmedBalanceWidget(dashboardViewModel: widget.dashboardViewModel,),
],
),
Observer(
+12
View File
@@ -143,6 +143,7 @@ abstract class SettingsStoreBase with Store {
required this.hasEnabledMwebBefore,
required this.mwebNodeUri,
required this.mwebAdDismissed,
required this.balanceHideCounter,
required bool initialEnableAutomaticNodeSwitching,
required String initialBackgroundImage,
TransactionPriority? initialBitcoinTransactionPriority,
@@ -720,6 +721,11 @@ abstract class SettingsStoreBase with Store {
PreferencesKey.decentralizedExchangesPromptDismissed,
decentralizedExchangesPromptDismissed));
reaction(
(_) => balanceHideCounter,
(int balanceHideCounter) => _sharedPreferences.setInt(PreferencesKey.balanceHideCounter, balanceHideCounter)
);
this.nodes.observe((change) {
if (change.newValue != null && change.key != null) {
_saveCurrentNode(change.newValue!, change.key!);
@@ -773,6 +779,9 @@ abstract class SettingsStoreBase with Store {
@observable
BalanceDisplayMode balanceDisplayMode;
@observable
int balanceHideCounter;
@observable
BitcoinAmountDisplayMode displayAmountsInSatoshi;
@@ -1552,6 +1561,8 @@ abstract class SettingsStoreBase with Store {
final mwebAdDismissed =
await sharedPreferences.getBool(PreferencesKey.mwebAdDismissed) ?? false;
final balanceHideCounter = await sharedPreferences.getInt(PreferencesKey.balanceHideCounter) ?? 0;
return SettingsStore(
secureStorage: secureStorage,
@@ -1663,6 +1674,7 @@ abstract class SettingsStoreBase with Store {
shouldShowRepWarning: shouldShowRepWarning,
initialBuiltinTor: builtinTor,
mwebAdDismissed: mwebAdDismissed,
balanceHideCounter: balanceHideCounter,
);
}
@@ -445,6 +445,7 @@ abstract class BalanceViewModelBase with Store {
void switchBalanceValue() {
if (settingsStore.balanceDisplayMode == BalanceDisplayMode.displayableBalance) {
settingsStore.balanceDisplayMode = BalanceDisplayMode.hiddenBalance;
settingsStore.balanceHideCounter++;
} else {
settingsStore.balanceDisplayMode = BalanceDisplayMode.displayableBalance;
}
@@ -632,6 +632,9 @@ abstract class DashboardViewModelBase with Store {
return trade.trade.walletId == wallet.id && isSameChain;
}).toList();
@computed
bool get shouldShowBalanceHiddenMessage => balanceDisplayMode == BalanceDisplayMode.hiddenBalance && appStore.settingsStore.balanceHideCounter < 10;
@computed
List<OrderListItem> get orders =>
ordersStore.orders.where((item) => item.order.walletId == wallet.id).toList();