mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
37 lines
1.3 KiB
Swift
37 lines
1.3 KiB
Swift
import SwiftUI
|
|
|
|
struct NotificationsView: View {
|
|
@EnvironmentObject var appState: AppState
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading) {
|
|
|
|
switch Current.notificationManager.notificationStatus {
|
|
case .shownAndAccepted:
|
|
Text("Access Granted. You will receive notifications from Xcodes.")
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
case .shownAndDenied:
|
|
Text("⚠️ Access Denied ⚠️\n\nPlease open your Notification Settings and select Xcodes if you wish to allow access.")
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
Button("Notification Settings", action: {
|
|
NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preference.notifications")!)
|
|
})
|
|
|
|
default:
|
|
Button("Enable Notifications", action: {
|
|
Current.notificationManager.requestAccess()
|
|
})
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
}
|
|
|
|
}
|
|
|
|
struct NotificationsView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
Group {
|
|
NotificationsView()
|
|
}
|
|
}
|
|
}
|