44 lines
1.2 KiB
Swift
44 lines
1.2 KiB
Swift
//
|
|
// NotificationsPrefsView.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 4/6/24.
|
|
// Copyright © 2024 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
import UserNotifications
|
|
import UserAccounts
|
|
import PushNotifications
|
|
import TuskerComponents
|
|
|
|
struct NotificationsPrefsView: View {
|
|
@State private var error: NotificationsSetupError?
|
|
@ObservedObject private var userAccounts = UserAccountsManager.shared
|
|
|
|
var body: some View {
|
|
List {
|
|
Section {
|
|
ForEach(userAccounts.accounts) { account in
|
|
PushInstanceSettingsView(account: account)
|
|
}
|
|
}
|
|
.appGroupedListRowBackground()
|
|
}
|
|
.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)"
|
|
}
|
|
}
|
|
}
|