50 lines
1.5 KiB
Swift
50 lines
1.5 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 {
|
|
@ObservedObject private var userAccounts = UserAccountsManager.shared
|
|
|
|
var body: some View {
|
|
List {
|
|
Section {
|
|
ForEach(userAccounts.accounts) { account in
|
|
PushInstanceSettingsView(account: account)
|
|
}
|
|
}
|
|
.appGroupedListRowBackground()
|
|
|
|
if #available(iOS 15.4, *) {
|
|
Section {
|
|
Button {
|
|
let str = if #available(iOS 16.0, *) {
|
|
UIApplication.openNotificationSettingsURLString
|
|
} else {
|
|
UIApplicationOpenNotificationSettingsURLString
|
|
}
|
|
if let url = URL(string: str) {
|
|
UIApplication.shared.open(url)
|
|
}
|
|
} label: {
|
|
Text("Open Notification Settings…")
|
|
}
|
|
}
|
|
.appGroupedListRowBackground()
|
|
}
|
|
}
|
|
.listStyle(.insetGrouped)
|
|
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
|
.navigationTitle("Notifications")
|
|
}
|
|
}
|