mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
add balance hidden message (#3132)
* add balance hidden message * add to translation * add to translation
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user