damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit ab8d52e685533022a6216eb141b8cc7bd6960f6e
parent 1d32200ae346bd3016590afe5fccdd618437f968
Author: Daniel D’Aquino <daniel@daquino.me>
Date:   Mon,  5 May 2025 10:24:02 -0700

Add option to dismiss wallet high balance warning

Changelog-Added: Add dismiss button to wallet high balance reminders
Closes: https://github.com/damus-io/damus/issues/2994
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>

Diffstat:
Mdamus/Models/UserSettingsStore.swift | 3+++
Mdamus/Views/Settings/ZapSettingsView.swift | 5+++++
Mdamus/Views/Wallet/NWCSettings.swift | 3+++
Mdamus/Views/Wallet/WalletView.swift | 11++++++++++-
4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/damus/Models/UserSettingsStore.swift b/damus/Models/UserSettingsStore.swift @@ -113,6 +113,9 @@ class UserSettingsStore: ObservableObject { @Setting(key: "show_wallet_selector", default_value: false) var show_wallet_selector: Bool + @Setting(key: "dismiss_wallet_high_balance_warning", default_value: false) + var dismiss_wallet_high_balance_warning: Bool + @Setting(key: "left_handed", default_value: false) var left_handed: Bool diff --git a/damus/Views/Settings/ZapSettingsView.swift b/damus/Views/Settings/ZapSettingsView.swift @@ -63,6 +63,11 @@ struct ZapSettingsView: View { } } } + + Section(NSLocalizedString("NWC wallet", comment: "Title for section in zap settings that controls general NWC wallet settings.")) { + Toggle(NSLocalizedString("Disable high balance warning", comment: "Setting to disable high balance warnings on the user's wallet"), isOn: $settings.dismiss_wallet_high_balance_warning) + .toggleStyle(.switch) + } } .navigationTitle(NSLocalizedString("Zaps", comment: "Navigation title for zap settings.")) .onReceive(handle_notify(.switched_timeline)) { _ in diff --git a/damus/Views/Wallet/NWCSettings.swift b/damus/Views/Wallet/NWCSettings.swift @@ -136,6 +136,9 @@ struct NWCSettings: View { AccountDetailsView(nwc: nwc) + Toggle(NSLocalizedString("Disable high balance warning", comment: "Setting to disable high balance warnings on the user's wallet"), isOn: $settings.dismiss_wallet_high_balance_warning) + .toggleStyle(.switch) + Button(action: { self.model.disconnect() dismiss() diff --git a/damus/Views/Wallet/WalletView.swift b/damus/Views/Wallet/WalletView.swift @@ -24,7 +24,7 @@ struct WalletView: View { func MainWalletView(nwc: WalletConnectURL) -> some View { ScrollView { VStack(spacing: 35) { - if let balance = model.balance, balance > WALLET_WARNING_THRESHOLD { + if let balance = model.balance, balance > WALLET_WARNING_THRESHOLD && !settings.dismiss_wallet_high_balance_warning { VStack(spacing: 10) { HStack { Image(systemName: "exclamationmark.circle") @@ -36,7 +36,16 @@ struct WalletView: View { Text("If your wallet balance is getting high, it's important to understand how to keep your funds secure. Please consider learning the best practices to ensure your assets remain safe. [Click here](https://damus.io/docs/wallet/high-balance-safety-reminder/) to learn more.", comment: "Text reminding the user has a high balance, recommending them to learn about self-custody") .foregroundStyle(.damusWarningSecondary) + .accentColor(.damusWarningTertiary) .opacity(0.8) + + Button(action: { + settings.dismiss_wallet_high_balance_warning = true + }, label: { + Text("Dismiss", comment: "Button label to dismiss the safety reminder that the user's wallet has a high balance") + }) + .bold() + .foregroundStyle(.damusWarningTertiary) } .padding() .overlay(