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. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -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<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> {
|
||||
Binding(
|
||||
get: { session.userLanguage ?? "en_US" },
|
||||
|
||||
Reference in New Issue
Block a user