Configurable notification dots
Changelog-Added: Make notification dots configurable
This commit is contained in:
@@ -11,7 +11,19 @@ struct NotificationSettingsView: View {
|
||||
@ObservedObject var settings: UserSettingsStore
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
|
||||
func indicator_binding(_ val: NewEventsBits) -> Binding<Bool> {
|
||||
return Binding.init(get: {
|
||||
(settings.notification_indicators & val.rawValue) > 0
|
||||
}, set: { v in
|
||||
if v {
|
||||
settings.notification_indicators |= val.rawValue
|
||||
} else {
|
||||
settings.notification_indicators &= ~val.rawValue
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section(header: Text(NSLocalizedString("Local Notifications", comment: "Section header for damus local notifications user configuration"))) {
|
||||
@@ -31,6 +43,17 @@ struct NotificationSettingsView: View {
|
||||
Toggle(NSLocalizedString("Show only from users you follow", comment: "Setting to Show notifications only associated to users your follow"), isOn: $settings.notification_only_from_following)
|
||||
.toggleStyle(.switch)
|
||||
}
|
||||
|
||||
Section(header: Text(NSLocalizedString("Notification Dots", comment: "Section header for notification indicator dot settings"))) {
|
||||
Toggle(NSLocalizedString("Zaps", comment: "Setting to enable Zap Local Notification"), isOn: indicator_binding(.zaps))
|
||||
.toggleStyle(.switch)
|
||||
Toggle(NSLocalizedString("Mentions", comment: "Setting to enable Mention Local Notification"), isOn: indicator_binding(.mentions))
|
||||
.toggleStyle(.switch)
|
||||
Toggle(NSLocalizedString("Reposts", comment: "Setting to enable Repost Local Notification"), isOn: indicator_binding(.reposts))
|
||||
.toggleStyle(.switch)
|
||||
Toggle(NSLocalizedString("Likes", comment: "Setting to enable Like Local Notification"), isOn: indicator_binding(.likes))
|
||||
.toggleStyle(.switch)
|
||||
}
|
||||
}
|
||||
.navigationTitle("Notifications")
|
||||
.onReceive(handle_notify(.switched_timeline)) { _ in
|
||||
|
||||
Reference in New Issue
Block a user