feat: Handle iOS background downloads

This commit is contained in:
ronaldheft
2022-08-30 22:14:59 -04:00
parent b02dd18e0b
commit 35631fb211
2 changed files with 21 additions and 1 deletions
+7
View File
@@ -6,6 +6,7 @@ import RealmSwift
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var backgroundCompletionHandler: (() -> Void)?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
@@ -72,6 +73,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// tracking app url opens, make sure to keep this call
return ApplicationDelegateProxy.shared.application(application, continue: userActivity, restorationHandler: restorationHandler)
}
func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
// Stores the completion handler for background downloads
// The identifier of this method can be ignored at this time as we only have one background url session
backgroundCompletionHandler = completionHandler
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)