1 // Copyright 2015-present 650 Industries. All rights reserved. 2 3 @import Foundation; 4 5 NS_ASSUME_NONNULL_BEGIN 6 7 extern NSString * const EXNetworkErrorDomain; 8 extern NSTimeInterval const EXFileDownloaderDefaultTimeoutInterval; 9 10 typedef void (^EXFileDownloaderSuccessBlock)(NSData *data, NSURLResponse *response); 11 typedef void (^EXFileDownloaderErrorBlock)(NSError *error, NSURLResponse *response); 12 13 @interface EXFileDownloader : NSObject 14 15 @property (nonatomic, strong, nullable) NSString *abiVersion; 16 @property (nonatomic, strong) NSURLSessionConfiguration *urlSessionConfiguration; // default is `defaultSessionConfiguration` 17 @property (nonatomic, assign) NSTimeInterval timeoutInterval; // default is NSURLRequest's default of 60 seconds. 18 @property (nonatomic, strong, nullable) NSString *releaseChannel; 19 20 - (void)downloadFileFromURL:(NSURL *)url 21 successBlock:(EXFileDownloaderSuccessBlock)successBlock 22 errorBlock:(EXFileDownloaderErrorBlock)errorBlock; 23 24 - (void)setHTTPHeaderFields:(NSMutableURLRequest *)request; 25 26 @end 27 28 NS_ASSUME_NONNULL_END 29