Add background task for overnight widget data refresh
- Create BackgroundTaskManager that schedules refresh at random time between 12:00 AM - 4:00 AM local time - Fetches tasks from API, writes to DataManager and shared App Group - Reloads widget timelines after refresh - Register task in AppDelegate, schedule when app goes to background - Add BGTaskSchedulerPermittedIdentifiers and fetch/processing modes to Info.plist 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import UIKit
|
||||
import UserNotifications
|
||||
import BackgroundTasks
|
||||
import ComposeApp
|
||||
|
||||
class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate {
|
||||
@@ -14,6 +15,9 @@ class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDele
|
||||
// Register notification categories for actionable notifications
|
||||
NotificationCategories.registerCategories()
|
||||
|
||||
// Register background tasks for overnight data refresh
|
||||
BackgroundTaskManager.shared.registerBackgroundTasks()
|
||||
|
||||
// Request notification permission
|
||||
Task { @MainActor in
|
||||
await PushNotificationManager.shared.requestNotificationPermission()
|
||||
|
||||
Reference in New Issue
Block a user