aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models/Preferences.swift
diff options
context:
space:
mode:
authorDustin Mierau <mierau@users.noreply.github.com>2024-05-14 15:40:07 -0700
committerGitHub <noreply@github.com>2024-05-14 15:40:07 -0700
commitec78dfa6c0a407cb9160e913886887a764f8e1d3 (patch)
tree486c877688ff11d636c8427e80243430329b41d4 /Hotline/Models/Preferences.swift
parent1dbc84ae671d87b7d5aaef35667c43a9d5fe9f37 (diff)
parent8dd886979ec61e5adb73d8c662de07070be75d41 (diff)
Merge pull request #19 from jhalter/add_show_join_leave_pref
Add "Show Join/Leave in Chat" option
Diffstat (limited to 'Hotline/Models/Preferences.swift')
-rw-r--r--Hotline/Models/Preferences.swift7
1 files changed, 7 insertions, 0 deletions
diff --git a/Hotline/Models/Preferences.swift b/Hotline/Models/Preferences.swift
index 3925bc7..207ce91 100644
--- a/Hotline/Models/Preferences.swift
+++ b/Hotline/Models/Preferences.swift
@@ -17,6 +17,7 @@ enum PrefsKeys: String {
case playErrorSound = "play error sound"
case playChatInvitationSound = "play chat invitation sound"
case showBannerToolbar = "show banner toolbar"
+ case showJoinLeaveMessages = "show join leave messages"
}
@Observable
@@ -39,6 +40,7 @@ class Prefs {
PrefsKeys.playErrorSound.rawValue: true,
PrefsKeys.playChatInvitationSound.rawValue: true,
PrefsKeys.showBannerToolbar.rawValue: true,
+ PrefsKeys.showJoinLeaveMessages.rawValue: true,
])
self.username = UserDefaults.standard.string(forKey: PrefsKeys.username.rawValue)!
@@ -57,6 +59,7 @@ class Prefs {
self.playErrorSound = UserDefaults.standard.bool(forKey: PrefsKeys.playErrorSound.rawValue)
self.playChatInvitationSound = UserDefaults.standard.bool(forKey: PrefsKeys.playChatInvitationSound.rawValue)
self.showBannerToolbar = UserDefaults.standard.bool(forKey: PrefsKeys.showBannerToolbar.rawValue)
+ self.showJoinLeaveMessages = UserDefaults.standard.bool(forKey: PrefsKeys.showJoinLeaveMessages.rawValue)
}
public static let shared = Prefs()
@@ -124,4 +127,8 @@ class Prefs {
var showBannerToolbar: Bool {
didSet { UserDefaults.standard.set(self.showBannerToolbar, forKey: PrefsKeys.showBannerToolbar.rawValue) }
}
+
+ var showJoinLeaveMessages: Bool {
+ didSet { UserDefaults.standard.set(self.showJoinLeaveMessages, forKey: PrefsKeys.showJoinLeaveMessages.rawValue) }
+ }
}