this repo has no description
1//
2// AppDelegate.swift
3// AtProtoBackup
4//
5// Created by Corey Alexander on 8/29/25.
6//
7#if os(iOS)
8import UIKit
9
10
11class AppDelegate: NSObject, UIApplicationDelegate {
12 func application(_ application: UIApplication,
13 handleEventsForBackgroundURLSession identifier: String,
14 completionHandler: @escaping () -> Void) {
15 print("[AppDelegate] Handling background URLSession events for identifier: \(identifier)")
16
17 // Note: We can't update Live Activities here because we don't have
18 // access to the download progress from the BlobDownloader.
19 // Live Activities will show stale data until the app returns to foreground.
20
21 // Let BlobDownloader handle the completion
22 BlobDownloader.handleEventsForBackgroundURLSession(
23 identifier: identifier,
24 completionHandler: completionHandler
25 )
26 }
27
28 func applicationDidEnterBackground(_ application: UIApplication) {
29 // Request background processing time
30 let backgroundTask = application.beginBackgroundTask {
31 // Expiration handler - called if we run out of time
32 }
33
34 // You get ~30 seconds to update Live Activities
35 Task {
36 // Note: We could update Live Activities here but we don't have
37 // access to current download progress. The DownloadManager would
38 // need to expose this data for background updates to work.
39 application.endBackgroundTask(backgroundTask)
40 }
41 }
42}
43#endif