field_ios

In-the-field app for Radroots on iOS
git clone https://radroots.dev/git/field_ios.git
Log | Files | Refs | LICENSE

RadrootsAppDelegate.swift (819B)


      1 import UIKit
      2 
      3 final class RadrootsAppDelegate: NSObject, UIApplicationDelegate {
      4     func application(
      5         _ application: UIApplication,
      6         handleEventsForBackgroundURLSession identifier: String,
      7         completionHandler: @escaping () -> Void
      8     ) {
      9         let completion = FieldBackgroundURLSessionCompletion(completionHandler)
     10         Task {
     11             await FieldBackgroundURLSessionEvents.shared.handleEvents(identifier: identifier) {
     12                 completion.complete()
     13             }
     14         }
     15     }
     16 }
     17 
     18 private final class FieldBackgroundURLSessionCompletion: @unchecked Sendable {
     19     private let completionHandler: () -> Void
     20 
     21     init(_ completionHandler: @escaping () -> Void) {
     22         self.completionHandler = completionHandler
     23     }
     24 
     25     func complete() {
     26         completionHandler()
     27     }
     28 }