Convert Notification settings to macOS-native helpers

This commit is contained in:
Arkadiusz Fal
2026-04-20 23:36:57 +02:00
parent 9912327448
commit c27fb3be34

View File

@@ -13,7 +13,7 @@ struct NotificationSettingsView: View {
@State private var authorizationChecked = false @State private var authorizationChecked = false
var body: some View { var body: some View {
Form { SettingsFormContainer {
if let settings = appEnvironment?.settingsManager, if let settings = appEnvironment?.settingsManager,
let notificationManager = appEnvironment?.notificationManager { let notificationManager = appEnvironment?.notificationManager {
// Master toggle section // Master toggle section
@@ -56,7 +56,7 @@ private struct EnableSection: View {
let appEnvironment: AppEnvironment? let appEnvironment: AppEnvironment?
var body: some View { var body: some View {
Section { SettingsFormSection(footer: "settings.notifications.footer") {
Toggle( Toggle(
String(localized: "settings.notifications.enable"), String(localized: "settings.notifications.enable"),
isOn: Binding( isOn: Binding(
@@ -70,8 +70,6 @@ private struct EnableSection: View {
} }
) )
) )
} footer: {
Text(String(localized: "settings.notifications.footer"))
} }
} }
@@ -97,7 +95,7 @@ private struct PermissionSection: View {
let notificationManager: NotificationManager let notificationManager: NotificationManager
var body: some View { var body: some View {
Section { SettingsFormSection {
HStack { HStack {
Text(String(localized: "settings.notifications.permission")) Text(String(localized: "settings.notifications.permission"))
Spacer() Spacer()
@@ -123,15 +121,11 @@ private struct DefaultsSection: View {
@Bindable var settings: SettingsManager @Bindable var settings: SettingsManager
var body: some View { var body: some View {
Section { SettingsFormSection("settings.notifications.defaults.header", footer: "settings.notifications.defaultForNew.footer") {
Toggle( Toggle(
String(localized: "settings.notifications.defaultForNew"), String(localized: "settings.notifications.defaultForNew"),
isOn: $settings.defaultNotificationsForNewChannels isOn: $settings.defaultNotificationsForNewChannels
) )
} header: {
Text(String(localized: "settings.notifications.defaults.header"))
} footer: {
Text(String(localized: "settings.notifications.defaultForNew.footer"))
} }
} }
} }
@@ -140,7 +134,8 @@ private struct DefaultsSection: View {
private struct ManageChannelsSection: View { private struct ManageChannelsSection: View {
var body: some View { var body: some View {
Section { SettingsFormSection {
#if os(tvOS)
NavigationLink { NavigationLink {
ManageChannelNotificationsView() ManageChannelNotificationsView()
} label: { } label: {
@@ -149,6 +144,11 @@ private struct ManageChannelsSection: View {
systemImage: "bell.badge" systemImage: "bell.badge"
) )
} }
#else
SettingsNavigationRow("settings.notifications.manageChannels", systemImage: "bell.badge") {
ManageChannelNotificationsView()
}
#endif
} }
} }
} }