Skip to content

Commit

Permalink
settings: record bool option keys
Browse files Browse the repository at this point in the history
so that NostrScripts know which bool settings can be set
  • Loading branch information
jb55 committed Jul 3, 2023
1 parent 94bd194 commit a6cbf50
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions damus/Models/UserSettingsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ let fallback_zap_amount = 1000
private var value: T

init(key: String, default_value: T) {
if T is bool {
UserSettingsStore.bool_options.insert(key)
}
self.key = pk_setting_key(UserSettingsStore.pubkey ?? "", key: key)
if let loaded = UserDefaults.standard.object(forKey: self.key) as? T {
self.value = loaded
Expand Down Expand Up @@ -77,6 +80,7 @@ let fallback_zap_amount = 1000
class UserSettingsStore: ObservableObject {
static var pubkey: String? = nil
static var shared: UserSettingsStore? = nil
static var bool_options = Set<String>()

@StringSetting(key: "default_wallet", default_value: .system_default_wallet)
var default_wallet: Wallet
Expand Down

0 comments on commit a6cbf50

Please sign in to comment.