123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- #import <Foundation/Foundation.h>
- #import "SDWebImageCompat.h"
- #import "SDWebImageOperation.h"
- typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
- SDWebImageDownloaderLowPriority = 1 << 0,
- SDWebImageDownloaderProgressiveDownload = 1 << 1,
-
- SDWebImageDownloaderUseNSURLCache = 1 << 2,
-
- SDWebImageDownloaderIgnoreCachedResponse = 1 << 3,
-
-
- SDWebImageDownloaderContinueInBackground = 1 << 4,
-
- SDWebImageDownloaderHandleCookies = 1 << 5,
-
- SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6,
-
- SDWebImageDownloaderHighPriority = 1 << 7,
-
-
- SDWebImageDownloaderScaleDownLargeImages = 1 << 8,
- };
- typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) {
-
- SDWebImageDownloaderFIFOExecutionOrder,
-
- SDWebImageDownloaderLIFOExecutionOrder
- };
- FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStartNotification;
- FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStopNotification;
- typedef void(^SDWebImageDownloaderProgressBlock)(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL);
- typedef void(^SDWebImageDownloaderCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished);
- typedef NSDictionary<NSString *, NSString *> SDHTTPHeadersDictionary;
- typedef NSMutableDictionary<NSString *, NSString *> SDHTTPHeadersMutableDictionary;
- typedef SDHTTPHeadersDictionary * _Nullable (^SDWebImageDownloaderHeadersFilterBlock)(NSURL * _Nullable url, SDHTTPHeadersDictionary * _Nullable headers);
- @interface SDWebImageDownloadToken : NSObject
- @property (nonatomic, strong, nullable) NSURL *url;
- @property (nonatomic, strong, nullable) id downloadOperationCancelToken;
- @end
- @interface SDWebImageDownloader : NSObject
- @property (assign, nonatomic) BOOL shouldDecompressImages;
- @property (assign, nonatomic) NSInteger maxConcurrentDownloads;
- @property (readonly, nonatomic) NSUInteger currentDownloadCount;
- @property (assign, nonatomic) NSTimeInterval downloadTimeout;
- @property (readonly, nonatomic, nonnull) NSURLSessionConfiguration *sessionConfiguration;
- @property (assign, nonatomic) SDWebImageDownloaderExecutionOrder executionOrder;
- + (nonnull instancetype)sharedDownloader;
- @property (strong, nonatomic, nullable) NSURLCredential *urlCredential;
- @property (strong, nonatomic, nullable) NSString *username;
- @property (strong, nonatomic, nullable) NSString *password;
- @property (nonatomic, copy, nullable) SDWebImageDownloaderHeadersFilterBlock headersFilter;
- - (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration NS_DESIGNATED_INITIALIZER;
- - (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field;
- - (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field;
- - (void)setOperationClass:(nullable Class)operationClass;
- - (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url
- options:(SDWebImageDownloaderOptions)options
- progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
- completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;
- - (void)cancel:(nullable SDWebImageDownloadToken *)token;
- - (void)setSuspended:(BOOL)suspended;
- - (void)cancelAllDownloads;
- - (void)createNewSessionWithConfiguration:(nonnull NSURLSessionConfiguration *)sessionConfiguration;
- @end
|