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>
This commit is contained in:
@@ -113,6 +113,9 @@ class UserSettingsStore: ObservableObject {
|
|||||||
@Setting(key: "show_wallet_selector", default_value: false)
|
@Setting(key: "show_wallet_selector", default_value: false)
|
||||||
var show_wallet_selector: Bool
|
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)
|
@Setting(key: "left_handed", default_value: false)
|
||||||
var left_handed: Bool
|
var left_handed: Bool
|
||||||
|
|
||||||
|
|||||||
@@ -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."))
|
.navigationTitle(NSLocalizedString("Zaps", comment: "Navigation title for zap settings."))
|
||||||
.onReceive(handle_notify(.switched_timeline)) { _ in
|
.onReceive(handle_notify(.switched_timeline)) { _ in
|
||||||
|
|||||||
@@ -136,6 +136,9 @@ struct NWCSettings: View {
|
|||||||
|
|
||||||
AccountDetailsView(nwc: nwc)
|
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: {
|
Button(action: {
|
||||||
self.model.disconnect()
|
self.model.disconnect()
|
||||||
dismiss()
|
dismiss()
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct WalletView: View {
|
|||||||
func MainWalletView(nwc: WalletConnectURL) -> some View {
|
func MainWalletView(nwc: WalletConnectURL) -> some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
VStack(spacing: 35) {
|
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) {
|
VStack(spacing: 10) {
|
||||||
HStack {
|
HStack {
|
||||||
Image(systemName: "exclamationmark.circle")
|
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")
|
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)
|
.foregroundStyle(.damusWarningSecondary)
|
||||||
|
.accentColor(.damusWarningTertiary)
|
||||||
.opacity(0.8)
|
.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()
|
.padding()
|
||||||
.overlay(
|
.overlay(
|
||||||
|
|||||||
Reference in New Issue
Block a user