Tusker/Tusker/Screens/Preferences/Notifications/NotificationsPrefsView.swift

44 lines
1.2 KiB
Swift
Raw Normal View History

2024-04-07 18:04:42 +00:00
//
// NotificationsPrefsView.swift
// Tusker
//
// Created by Shadowfacts on 4/6/24.
// Copyright © 2024 Shadowfacts. All rights reserved.
//
import SwiftUI
import UserNotifications
import UserAccounts
import PushNotifications
2024-04-08 22:45:54 +00:00
import TuskerComponents
2024-04-07 18:04:42 +00:00
struct NotificationsPrefsView: View {
@State private var error: NotificationsSetupError?
@ObservedObject private var userAccounts = UserAccountsManager.shared
2024-04-07 18:04:42 +00:00
var body: some View {
List {
Section {
ForEach(userAccounts.accounts) { account in
PushInstanceSettingsView(account: account)
}
}
.appGroupedListRowBackground()
2024-04-07 18:04:42 +00:00
}
.listStyle(.insetGrouped)
.appGroupedListBackground(container: PreferencesNavigationController.self)
.navigationTitle("Notifications")
}
}
private enum NotificationsSetupError: LocalizedError {
case requestingAuthorization(any Error)
var errorDescription: String? {
switch self {
case .requestingAuthorization(let error):
"Notifications authorization request failed: \(error.localizedDescription)"
}
}
}