05/15 Update: show issue's images, push notifications

This commit is contained in:
Nguyen Ngo
2026-05-15 15:41:13 -04:00
parent 9fd3f5b829
commit 7320e88dec
7 changed files with 398 additions and 14 deletions
+15
View File
@@ -5,6 +5,7 @@
import SwiftUI
import SwiftData
import BackgroundTasks
import UserNotifications
@main
struct JanitorialQCApp: App {
@@ -14,6 +15,7 @@ struct JanitorialQCApp: App {
init() {
registerBackgroundTasks()
requestNotificationPermission()
}
var body: some Scene {
@@ -44,6 +46,19 @@ struct JanitorialQCApp: App {
}
}
// Local notification permission
// Request permission for local notifications (used by the polling poller
// to alert inspectors of new assignments and follow-up requests).
// Called at init iOS caches the grant; subsequent calls are no-ops.
private func requestNotificationPermission() {
UNUserNotificationCenter.current().requestAuthorization(
options: [.alert, .sound, .badge]
) { granted, error in
if let error { print("[JQC] Notification permission error: \(error)") }
}
}
private func registerBackgroundTasks() {
BGTaskScheduler.shared.register(
forTaskWithIdentifier: "com.jqc.sync",