refactor: move notification settings to its own file

This commit is contained in:
William Casarin
2023-04-05 08:49:15 -07:00
parent 0436c68ec5
commit 2ce0a771ea
3 changed files with 54 additions and 27 deletions

View File

@@ -0,0 +1,41 @@
//
// NotificationSettings.swift
// damus
//
// Created by William Casarin on 2023-04-05.
//
import SwiftUI
struct NotificationSettingsView: View {
@ObservedObject var settings: UserSettingsStore
var body: some View {
Form {
Section(header: Text(NSLocalizedString("Local Notifications", comment: "Section header for damus local notifications user configuration"))) {
Toggle(NSLocalizedString("Zaps", comment: "Setting to enable Zap Local Notification"), isOn: $settings.zap_notification)
.toggleStyle(.switch)
Toggle(NSLocalizedString("Mentions", comment: "Setting to enable Mention Local Notification"), isOn: $settings.mention_notification)
.toggleStyle(.switch)
Toggle(NSLocalizedString("Reposts", comment: "Setting to enable Repost Local Notification"), isOn: $settings.repost_notification)
.toggleStyle(.switch)
Toggle(NSLocalizedString("Likes", comment: "Setting to enable Like Local Notification"), isOn: $settings.like_notification)
.toggleStyle(.switch)
Toggle(NSLocalizedString("DMs", comment: "Setting to enable DM Local Notification"), isOn: $settings.dm_notification)
.toggleStyle(.switch)
}
Section(header: Text(NSLocalizedString("Notification Preference", comment: "Section header for Notification Preferences"))) {
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)
}
}
}
}
struct NotificationSettings_Previews: PreviewProvider {
static var previews: some View {
NotificationSettingsView(settings: UserSettingsStore())
}
}