xref: /expo/packages/expo-file-system/ios/FileSystemBackgroundSessionHandler.swift (revision 1aeb130d)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023-present 650 Industries. All rights reserved.
2 
3 import ExpoModulesCore
4 
5 public final class FileSystemBackgroundSessionHandler: ExpoAppDelegateSubscriber, EXSessionHandlerProtocol {
6   public typealias BackgroundSessionCompletionHandler = () -> Void
7 
8   private var completionHandlers: [String: BackgroundSessionCompletionHandler] = [:]
9 
10   public func invokeCompletionHandler(forSessionIdentifier identifier: String) {
11     guard let completionHandler = completionHandlers[identifier] else {
12       return
13     }
14     DispatchQueue.main.async {
15       completionHandler()
16     }
17     completionHandlers.removeValue(forKey: identifier)
18   }
19 
20   // MARK: - ExpoAppDelegateSubscriber
21 
22   public func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
23     completionHandlers[identifier] = completionHandler
24   }
25 }
26 

served by {OpenGrok

Last Index Update: Fri May 15 20:09:11 GMT 2026