From ab8d52e685533022a6216eb141b8cc7bd6960f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=E2=80=99Aquino?= Date: Mon, 5 May 2025 10:24:02 -0700 Subject: [PATCH] Add option to dismiss wallet high balance warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- damus/Models/UserSettingsStore.swift | 3 +++ damus/Views/Settings/ZapSettingsView.swift | 5 +++++ damus/Views/Wallet/NWCSettings.swift | 3 +++ damus/Views/Wallet/WalletView.swift | 11 ++++++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/damus/Models/UserSettingsStore.swift b/damus/Models/UserSettingsStore.swift index 860b53cc..dd25f3ba 100644 --- 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 index 71bf9e10..dc3a165d 100644 --- 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 index ae2bb94d..9ab423b7 100644 --- 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 index cf644623..981d6da8 100644 --- 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(