feat(settings): Preferences notification-badge picker

Closes out the Behavior subsection. Uses NotificationBadgeStyle
(None/Unread Indicator/Unread Count) — wire values are a guess same as
the other preference keys, flagged in OutlineUserPreferences.
This commit is contained in:
2026-08-15 20:31:24 +01:00
parent 78e1c158aa
commit cac11f0a22
@@ -293,6 +293,8 @@ struct SettingsView: View {
isOn: session.userPreferences?.smartText ?? false, isOn: session.userPreferences?.smartText ?? false,
onChange: { newValue in Task { await savePreference { $0.smartText = newValue } } } onChange: { newValue in Task { await savePreference { $0.smartText = newValue } } }
) )
Divider()
notificationBadgeRow
} }
if let preferencesErrorMessage { 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<NotificationBadgeStyle> {
Binding(
get: {
session.userPreferences?.notificationBadge.flatMap(NotificationBadgeStyle.init(rawValue:)) ?? .all
},
set: { newValue in Task { await savePreference { $0.notificationBadge = newValue.rawValue } } }
)
}
private var languageBinding: Binding<String> { private var languageBinding: Binding<String> {
Binding( Binding(
get: { session.userLanguage ?? "en_US" }, get: { session.userLanguage ?? "en_US" },