diff --git a/Outpost/Features/Account/SettingsView.swift b/Outpost/Features/Account/SettingsView.swift index 771d4dd..5bdb771 100644 --- a/Outpost/Features/Account/SettingsView.swift +++ b/Outpost/Features/Account/SettingsView.swift @@ -293,6 +293,8 @@ struct SettingsView: View { isOn: session.userPreferences?.smartText ?? false, onChange: { newValue in Task { await savePreference { $0.smartText = newValue } } } ) + Divider() + notificationBadgeRow } if let preferencesErrorMessage { @@ -370,6 +372,34 @@ struct SettingsView: View { } } + private var notificationBadgeRow: some View { + HStack { + VStack(alignment: .leading, spacing: 2) { + Text("Notification badge") + Text("Choose how unread notifications are indicated on the app icon.") + .font(.caption) + .foregroundStyle(.secondary) + } + Spacer() + Picker("Notification badge", selection: notificationBadgeBinding) { + ForEach(NotificationBadgeStyle.allCases) { style in + Text(style.label).tag(style) + } + } + .labelsHidden() + .frame(width: 160) + } + } + + private var notificationBadgeBinding: Binding { + Binding( + get: { + session.userPreferences?.notificationBadge.flatMap(NotificationBadgeStyle.init(rawValue:)) ?? .all + }, + set: { newValue in Task { await savePreference { $0.notificationBadge = newValue.rawValue } } } + ) + } + private var languageBinding: Binding { Binding( get: { session.userLanguage ?? "en_US" },