@octane-xplat/nativescript-mason-core 0.0.1 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +198 -2
  3. package/artifact-inventory.json +774 -0
  4. package/box-shadow.d.ts +10 -0
  5. package/box-shadow.js +48 -0
  6. package/common.d.ts +485 -0
  7. package/common.js +2659 -0
  8. package/css-colors.d.ts +17 -0
  9. package/css-colors.js +54 -0
  10. package/css-environment.d.ts +49 -0
  11. package/css-environment.js +309 -0
  12. package/css-filter.d.ts +17 -0
  13. package/css-filter.js +140 -0
  14. package/css-keyframes.d.ts +41 -0
  15. package/css-keyframes.js +437 -0
  16. package/css-math.d.ts +34 -0
  17. package/css-math.js +300 -0
  18. package/css-shorthands.d.ts +65 -0
  19. package/css-shorthands.js +673 -0
  20. package/css-transform.d.ts +6 -0
  21. package/css-transform.js +100 -0
  22. package/diagnostics.d.ts +51 -0
  23. package/diagnostics.js +52 -0
  24. package/display-density.d.ts +9 -0
  25. package/display-density.js +20 -0
  26. package/fonts.d.ts +20 -0
  27. package/fonts.js +88 -0
  28. package/foreign-layout.d.ts +6 -0
  29. package/foreign-layout.js +151 -0
  30. package/gradient-stops.d.ts +25 -0
  31. package/gradient-stops.js +112 -0
  32. package/index.android.d.ts +11 -0
  33. package/index.android.js +9 -0
  34. package/index.d.ts +12 -0
  35. package/index.ios.d.ts +11 -0
  36. package/index.ios.js +9 -0
  37. package/ios-host-README.md +124 -0
  38. package/layout-types.d.ts +192 -0
  39. package/mask.d.ts +54 -0
  40. package/mask.js +26 -0
  41. package/native-environment.android.d.ts +3 -0
  42. package/native-environment.android.js +69 -0
  43. package/native-environment.d.ts +3 -0
  44. package/native-environment.ios.d.ts +3 -0
  45. package/native-environment.ios.js +65 -0
  46. package/native-types-README.md +51 -0
  47. package/package.json +47 -6
  48. package/panel-helpers.d.ts +3 -0
  49. package/panel-helpers.js +8 -0
  50. package/platforms/android/MasonCore.aar +0 -0
  51. package/platforms/android/include.gradle +6 -0
  52. package/platforms/android/manifest.json +73 -0
  53. package/platforms/ios/FontManager.LICENSE +201 -0
  54. package/platforms/ios/MasonCore.xcframework/Info.plist +43 -0
  55. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/Mason.h +25 -0
  56. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/MasonCore-Swift.h +1739 -0
  57. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/mason_native.h +601 -0
  58. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Info.plist +0 -0
  59. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/MasonCore +0 -0
  60. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  61. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.abi.json +100095 -0
  62. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.private.swiftinterface +3174 -0
  63. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  64. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.swiftinterface +3174 -0
  65. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/module.modulemap +9 -0
  66. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/SDWebImage_SDWebImage.bundle/Info.plist +0 -0
  67. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/SDWebImage_SDWebImage.bundle/PrivacyInfo.xcprivacy +23 -0
  68. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/Mason.h +25 -0
  69. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/MasonCore-Swift.h +1739 -0
  70. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/mason_native.h +601 -0
  71. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Info.plist +0 -0
  72. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/MasonCore +0 -0
  73. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  74. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.abi.json +100095 -0
  75. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3174 -0
  76. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  77. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3174 -0
  78. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/module.modulemap +9 -0
  79. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/SDWebImage_SDWebImage.bundle/Info.plist +0 -0
  80. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/SDWebImage_SDWebImage.bundle/PrivacyInfo.xcprivacy +23 -0
  81. package/platforms/ios/Package.resolved +24 -0
  82. package/platforms/ios/SDWebImage.LICENSE +20 -0
  83. package/platforms/ios/build.xcconfig +4 -0
  84. package/platforms/ios/device-manifest.json +213 -0
  85. package/platforms/ios/include/FontManager/NSCFontDescriptors.h +36 -0
  86. package/platforms/ios/include/FontManager/NSCFontFace.h +98 -0
  87. package/platforms/ios/include/FontManager/NSCFontFaceSet.h +73 -0
  88. package/platforms/ios/include/FontManager/NSCFontManagerUmbrella.h +7 -0
  89. package/platforms/ios/include/FontManager/NSCFontParser.h +22 -0
  90. package/platforms/ios/include/FontManager/NSCFontRegex.h +4 -0
  91. package/platforms/ios/include/FontManager/NSCFontResolver.h +43 -0
  92. package/platforms/ios/include/FontManager/NSCFontStyle.h +27 -0
  93. package/platforms/ios/include/FontManager/NSCFontTypes.h +41 -0
  94. package/platforms/ios/include/SDWebImage/NSButton+WebCache.h +340 -0
  95. package/platforms/ios/include/SDWebImage/NSData+ImageContentType.h +63 -0
  96. package/platforms/ios/include/SDWebImage/NSImage+Compatibility.h +67 -0
  97. package/platforms/ios/include/SDWebImage/SDAnimatedImage.h +136 -0
  98. package/platforms/ios/include/SDWebImage/SDAnimatedImagePlayer.h +113 -0
  99. package/platforms/ios/include/SDWebImage/SDAnimatedImageRep.h +33 -0
  100. package/platforms/ios/include/SDWebImage/SDAnimatedImageView+WebCache.h +168 -0
  101. package/platforms/ios/include/SDWebImage/SDAnimatedImageView.h +125 -0
  102. package/platforms/ios/include/SDWebImage/SDCallbackQueue.h +59 -0
  103. package/platforms/ios/include/SDWebImage/SDDiskCache.h +146 -0
  104. package/platforms/ios/include/SDWebImage/SDGraphicsImageRenderer.h +84 -0
  105. package/platforms/ios/include/SDWebImage/SDImageAPNGCoder.h +19 -0
  106. package/platforms/ios/include/SDWebImage/SDImageAWebPCoder.h +23 -0
  107. package/platforms/ios/include/SDWebImage/SDImageCache.h +482 -0
  108. package/platforms/ios/include/SDWebImage/SDImageCacheConfig.h +153 -0
  109. package/platforms/ios/include/SDWebImage/SDImageCacheDefine.h +179 -0
  110. package/platforms/ios/include/SDWebImage/SDImageCachesManager.h +81 -0
  111. package/platforms/ios/include/SDWebImage/SDImageCoder.h +347 -0
  112. package/platforms/ios/include/SDWebImage/SDImageCoderHelper.h +251 -0
  113. package/platforms/ios/include/SDWebImage/SDImageCodersManager.h +58 -0
  114. package/platforms/ios/include/SDWebImage/SDImageFrame.h +44 -0
  115. package/platforms/ios/include/SDWebImage/SDImageGIFCoder.h +22 -0
  116. package/platforms/ios/include/SDWebImage/SDImageGraphics.h +28 -0
  117. package/platforms/ios/include/SDWebImage/SDImageHEICCoder.h +25 -0
  118. package/platforms/ios/include/SDWebImage/SDImageIOAnimatedCoder.h +65 -0
  119. package/platforms/ios/include/SDWebImage/SDImageIOCoder.h +30 -0
  120. package/platforms/ios/include/SDWebImage/SDImageLoader.h +146 -0
  121. package/platforms/ios/include/SDWebImage/SDImageLoadersManager.h +40 -0
  122. package/platforms/ios/include/SDWebImage/SDImageTransformer.h +283 -0
  123. package/platforms/ios/include/SDWebImage/SDMemoryCache.h +78 -0
  124. package/platforms/ios/include/SDWebImage/SDWebImage.h +91 -0
  125. package/platforms/ios/include/SDWebImage/SDWebImageCacheKeyFilter.h +35 -0
  126. package/platforms/ios/include/SDWebImage/SDWebImageCacheSerializer.h +39 -0
  127. package/platforms/ios/include/SDWebImage/SDWebImageCompat.h +102 -0
  128. package/platforms/ios/include/SDWebImage/SDWebImageDefine.h +420 -0
  129. package/platforms/ios/include/SDWebImage/SDWebImageDownloader.h +320 -0
  130. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderConfig.h +113 -0
  131. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderDecryptor.h +52 -0
  132. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderOperation.h +191 -0
  133. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderRequestModifier.h +72 -0
  134. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderResponseModifier.h +72 -0
  135. package/platforms/ios/include/SDWebImage/SDWebImageError.h +33 -0
  136. package/platforms/ios/include/SDWebImage/SDWebImageIndicator.h +119 -0
  137. package/platforms/ios/include/SDWebImage/SDWebImageManager.h +290 -0
  138. package/platforms/ios/include/SDWebImage/SDWebImageOperation.h +27 -0
  139. package/platforms/ios/include/SDWebImage/SDWebImageOptionsProcessor.h +78 -0
  140. package/platforms/ios/include/SDWebImage/SDWebImagePrefetcher.h +168 -0
  141. package/platforms/ios/include/SDWebImage/SDWebImageTransition.h +131 -0
  142. package/platforms/ios/include/SDWebImage/UIButton+WebCache.h +402 -0
  143. package/platforms/ios/include/SDWebImage/UIImage+ExtendedCacheData.h +24 -0
  144. package/platforms/ios/include/SDWebImage/UIImage+ForceDecode.h +52 -0
  145. package/platforms/ios/include/SDWebImage/UIImage+GIF.h +26 -0
  146. package/platforms/ios/include/SDWebImage/UIImage+MemoryCacheCost.h +27 -0
  147. package/platforms/ios/include/SDWebImage/UIImage+Metadata.h +104 -0
  148. package/platforms/ios/include/SDWebImage/UIImage+MultiFormat.h +81 -0
  149. package/platforms/ios/include/SDWebImage/UIImage+Transform.h +164 -0
  150. package/platforms/ios/include/SDWebImage/UIImageView+HighlightedWebCache.h +142 -0
  151. package/platforms/ios/include/SDWebImage/UIImageView+WebCache.h +209 -0
  152. package/platforms/ios/include/SDWebImage/UIView+WebCache.h +131 -0
  153. package/platforms/ios/include/SDWebImage/UIView+WebCacheOperation.h +52 -0
  154. package/platforms/ios/include/SDWebImage/UIView+WebCacheState.h +63 -0
  155. package/platforms/ios/include/module.modulemap +2 -0
  156. package/platforms/ios/manifest.json +132 -0
  157. package/platforms/ios/simulator-manifest.json +213 -0
  158. package/plugin-README.md +234 -0
  159. package/properties.d.ts +154 -0
  160. package/properties.js +2456 -0
  161. package/pseudo.d.ts +9 -0
  162. package/pseudo.js +57 -0
  163. package/scroll/index.android.d.ts +15 -0
  164. package/scroll/index.android.js +72 -0
  165. package/scroll/index.d.ts +5 -0
  166. package/scroll/index.ios.d.ts +18 -0
  167. package/scroll/index.ios.js +106 -0
  168. package/style.d.ts +768 -0
  169. package/style.js +7167 -0
  170. package/symbols.d.ts +25 -0
  171. package/symbols.js +41 -0
  172. package/tree/index.android.d.ts +11 -0
  173. package/tree/index.android.js +42 -0
  174. package/tree/index.d.ts +15 -0
  175. package/tree/index.ios.d.ts +26 -0
  176. package/tree/index.ios.js +53 -0
  177. package/typings/android-declarations.d.ts +4 -0
  178. package/typings/android.d.ts +9730 -0
  179. package/typings/manifest.json +45 -0
  180. package/typings/native.d.ts +5 -0
  181. package/typings/objc!FontManager.d.ts +389 -0
  182. package/typings/objc!MasonCore.d.ts +2472 -0
  183. package/typings/objc!SDWebImage.d.ts +3378 -0
  184. package/units.d.ts +29 -0
  185. package/units.js +44 -0
  186. package/utils/index.android.d.ts +211 -0
  187. package/utils/index.android.js +595 -0
  188. package/utils/index.ios.d.ts +222 -0
  189. package/utils/index.ios.js +790 -0
  190. package/view/index.android.d.ts +13 -0
  191. package/view/index.android.js +74 -0
  192. package/view/index.d.ts +2 -0
  193. package/view/index.ios.d.ts +24 -0
  194. package/view/index.ios.js +157 -0
@@ -0,0 +1,320 @@
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code.
7
+ */
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "SDWebImageCompat.h"
11
+ #import "SDWebImageDefine.h"
12
+ #import "SDWebImageOperation.h"
13
+ #import "SDWebImageDownloaderConfig.h"
14
+ #import "SDWebImageDownloaderRequestModifier.h"
15
+ #import "SDWebImageDownloaderResponseModifier.h"
16
+ #import "SDWebImageDownloaderDecryptor.h"
17
+ #import "SDImageLoader.h"
18
+
19
+ /// Downloader options
20
+ typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
21
+ /**
22
+ * Put the download in the low queue priority and task priority.
23
+ */
24
+ SDWebImageDownloaderLowPriority = 1 << 0,
25
+
26
+ /**
27
+ * This flag enables progressive download, the image is displayed progressively during download as a browser would do.
28
+ */
29
+ SDWebImageDownloaderProgressiveLoad = 1 << 1,
30
+
31
+ /**
32
+ * By default, request prevent the use of NSURLCache. With this flag, NSURLCache
33
+ * is used with default policies.
34
+ */
35
+ SDWebImageDownloaderUseNSURLCache = 1 << 2,
36
+
37
+ /**
38
+ * Call completion block with nil image/imageData if the image was read from NSURLCache
39
+ * And the error code is `SDWebImageErrorCacheNotModified`
40
+ * This flag should be combined with `SDWebImageDownloaderUseNSURLCache`.
41
+ */
42
+ SDWebImageDownloaderIgnoreCachedResponse = 1 << 3,
43
+
44
+ /**
45
+ * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for
46
+ * extra time in background to let the request finish. If the background task expires the operation will be cancelled.
47
+ */
48
+ SDWebImageDownloaderContinueInBackground = 1 << 4,
49
+
50
+ /**
51
+ * Handles cookies stored in NSHTTPCookieStore by setting
52
+ * NSMutableURLRequest.HTTPShouldHandleCookies = YES;
53
+ */
54
+ SDWebImageDownloaderHandleCookies = 1 << 5,
55
+
56
+ /**
57
+ * Enable to allow untrusted SSL certificates.
58
+ * Useful for testing purposes. Use with caution in production.
59
+ */
60
+ SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6,
61
+
62
+ /**
63
+ * Put the download in the high queue priority and task priority.
64
+ */
65
+ SDWebImageDownloaderHighPriority = 1 << 7,
66
+
67
+ /**
68
+ * By default, images are decoded respecting their original size. On iOS, this flag will scale down the
69
+ * images to a size compatible with the constrained memory of devices.
70
+ * This flag take no effect if `SDWebImageDownloaderAvoidDecodeImage` is set. And it will be ignored if `SDWebImageDownloaderProgressiveLoad` is set.
71
+ */
72
+ SDWebImageDownloaderScaleDownLargeImages = 1 << 8,
73
+
74
+ /**
75
+ * By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation.
76
+ * However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image.
77
+ * @note 5.14.0 introduce `SDImageCoderDecodeUseLazyDecoding`, use that for better control from codec, instead of post-processing. Which acts the similar like this option but works for SDAnimatedImage as well (this one does not)
78
+ * @deprecated Deprecated in v5.17.0, if you don't want force-decode, pass [.imageForceDecodePolicy] = SDImageForceDecodePolicy.never.rawValue in context option
79
+ */
80
+ SDWebImageDownloaderAvoidDecodeImage API_DEPRECATED("Use SDWebImageContextImageForceDecodePolicy instead", macos(10.10, 10.10), ios(8.0, 8.0), tvos(9.0, 9.0), watchos(2.0, 2.0)) = 1 << 9,
81
+
82
+ /**
83
+ * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image.
84
+ */
85
+ SDWebImageDownloaderDecodeFirstFrameOnly = 1 << 10,
86
+
87
+ /**
88
+ * By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. This flag actually trigger `preloadAllAnimatedImageFrames = YES` after image load from network
89
+ */
90
+ SDWebImageDownloaderPreloadAllFrames = 1 << 11,
91
+
92
+ /**
93
+ * By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available, to behave as a fallback solution.
94
+ * Using this option, can ensure we always produce image with your provided class. If failed, a error with code `SDWebImageErrorBadImageData` will been used.
95
+ * Note this options is not compatible with `SDWebImageDownloaderDecodeFirstFrameOnly`, which always produce a UIImage/NSImage.
96
+ */
97
+ SDWebImageDownloaderMatchAnimatedImageClass = 1 << 12,
98
+ };
99
+
100
+ /// Posed when URLSessionTask started (`resume` called))
101
+ FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadStartNotification;
102
+ /// Posed when URLSessionTask get HTTP response (`didReceiveResponse:completionHandler:` called)
103
+ FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadReceiveResponseNotification;
104
+ /// Posed when URLSessionTask stoped (`didCompleteWithError:` with error or `cancel` called)
105
+ FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadStopNotification;
106
+ /// Posed when URLSessionTask finished with success (`didCompleteWithError:` without error)
107
+ FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadFinishNotification;
108
+
109
+ typedef SDImageLoaderProgressBlock SDWebImageDownloaderProgressBlock;
110
+ typedef SDImageLoaderCompletedBlock SDWebImageDownloaderCompletedBlock;
111
+
112
+ /**
113
+ * A token associated with each download. Can be used to cancel a download
114
+ */
115
+ @interface SDWebImageDownloadToken : NSObject <SDWebImageOperation>
116
+
117
+ /**
118
+ Cancel the current download.
119
+ */
120
+ - (void)cancel;
121
+
122
+ /**
123
+ The download's URL.
124
+ */
125
+ @property (nonatomic, strong, nullable, readonly) NSURL *url;
126
+
127
+ /**
128
+ The download's request.
129
+ */
130
+ @property (nonatomic, strong, nullable, readonly) NSURLRequest *request;
131
+
132
+ /**
133
+ The download's response.
134
+ */
135
+ @property (nonatomic, strong, nullable, readonly) NSURLResponse *response;
136
+
137
+ /**
138
+ The download's metrics. This will be nil if download operation does not support metrics.
139
+ */
140
+ @property (nonatomic, strong, nullable, readonly) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0));
141
+
142
+ @end
143
+
144
+
145
+ /**
146
+ * Asynchronous downloader dedicated and optimized for image loading.
147
+ */
148
+ @interface SDWebImageDownloader : NSObject
149
+
150
+ /**
151
+ * Downloader Config object - storing all kind of settings.
152
+ * Most config properties support dynamic changes during download, except something like `sessionConfiguration`, see `SDWebImageDownloaderConfig` for more detail.
153
+ */
154
+ @property (nonatomic, copy, readonly, nonnull) SDWebImageDownloaderConfig *config;
155
+
156
+ /**
157
+ * Set the request modifier to modify the original download request before image load.
158
+ * This request modifier method will be called for each downloading image request. Return the original request means no modification. Return nil will cancel the download request.
159
+ * Defaults to nil, means does not modify the original download request.
160
+ * @note If you want to modify single request, consider using `SDWebImageContextDownloadRequestModifier` context option.
161
+ */
162
+ @property (nonatomic, strong, nullable) id<SDWebImageDownloaderRequestModifier> requestModifier;
163
+
164
+ /**
165
+ * Set the response modifier to modify the original download response during image load.
166
+ * This response modifier method will be called for each downloading image response. Return the original response means no modification. Return nil will mark current download as cancelled.
167
+ * Defaults to nil, means does not modify the original download response.
168
+ * @note If you want to modify single response, consider using `SDWebImageContextDownloadResponseModifier` context option.
169
+ */
170
+ @property (nonatomic, strong, nullable) id<SDWebImageDownloaderResponseModifier> responseModifier;
171
+
172
+ /**
173
+ * Set the decryptor to decrypt the original download data before image decoding. This can be used for encrypted image data, like Base64.
174
+ * This decryptor method will be called for each downloading image data. Return the original data means no modification. Return nil will mark this download failed.
175
+ * Defaults to nil, means does not modify the original download data.
176
+ * @note When using decryptor, progressive decoding will be disabled, to avoid data corrupt issue.
177
+ * @note If you want to decrypt single download data, consider using `SDWebImageContextDownloadDecryptor` context option.
178
+ */
179
+ @property (nonatomic, strong, nullable) id<SDWebImageDownloaderDecryptor> decryptor;
180
+
181
+ /**
182
+ * The configuration in use by the internal NSURLSession. If you want to provide a custom sessionConfiguration, use `SDWebImageDownloaderConfig.sessionConfiguration` and create a new downloader instance.
183
+ @note This is immutable according to NSURLSession's documentation. Mutating this object directly has no effect.
184
+ */
185
+ @property (nonatomic, readonly, nonnull) NSURLSessionConfiguration *sessionConfiguration;
186
+
187
+ /**
188
+ * Gets/Sets the download queue suspension state.
189
+ */
190
+ @property (nonatomic, assign, getter=isSuspended) BOOL suspended;
191
+
192
+ /**
193
+ * Shows the current amount of downloads that still need to be downloaded
194
+ */
195
+ @property (nonatomic, assign, readonly) NSUInteger currentDownloadCount;
196
+
197
+ /**
198
+ * Returns the global shared downloader instance. Which use the `SDWebImageDownloaderConfig.defaultDownloaderConfig` config.
199
+ */
200
+ @property (nonatomic, class, readonly, nonnull) SDWebImageDownloader *sharedDownloader;
201
+
202
+ /**
203
+ Creates an instance of a downloader with specified downloader config.
204
+ You can specify session configuration, timeout or operation class through downloader config.
205
+
206
+ @param config The downloader config. If you specify nil, the `defaultDownloaderConfig` will be used.
207
+ @return new instance of downloader class
208
+ */
209
+ - (nonnull instancetype)initWithConfig:(nullable SDWebImageDownloaderConfig *)config NS_DESIGNATED_INITIALIZER;
210
+
211
+ /**
212
+ * Set a value for a HTTP header to be appended to each download HTTP request.
213
+ *
214
+ * @param value The value for the header field. Use `nil` value to remove the header field.
215
+ * @param field The name of the header field to set.
216
+ */
217
+ - (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field;
218
+
219
+ /**
220
+ * Returns the value of the specified HTTP header field.
221
+ *
222
+ * @return The value associated with the header field field, or `nil` if there is no corresponding header field.
223
+ */
224
+ - (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field;
225
+
226
+ /**
227
+ * Creates a SDWebImageDownloader async downloader instance with a given URL
228
+ *
229
+ * The delegate will be informed when the image is finish downloaded or an error has happen.
230
+ *
231
+ * @see SDWebImageDownloaderDelegate
232
+ *
233
+ * @param url The URL to the image to download
234
+ * @param completedBlock A block called once the download is completed.
235
+ * If the download succeeded, the image parameter is set, in case of error,
236
+ * error parameter is set with the error. The last parameter is always YES
237
+ * if SDWebImageDownloaderProgressiveDownload isn't use. With the
238
+ * SDWebImageDownloaderProgressiveDownload option, this block is called
239
+ * repeatedly with the partial image object and the finished argument set to NO
240
+ * before to be called a last time with the full image and finished argument
241
+ * set to YES. In case of error, the finished argument is always YES.
242
+ *
243
+ * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation
244
+ */
245
+ - (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url
246
+ completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;
247
+
248
+ /**
249
+ * Creates a SDWebImageDownloader async downloader instance with a given URL
250
+ *
251
+ * The delegate will be informed when the image is finish downloaded or an error has happen.
252
+ *
253
+ * @see SDWebImageDownloaderDelegate
254
+ *
255
+ * @param url The URL to the image to download
256
+ * @param options The options to be used for this download
257
+ * @param progressBlock A block called repeatedly while the image is downloading
258
+ * @note the progress block is executed on a background queue
259
+ * @param completedBlock A block called once the download is completed.
260
+ * If the download succeeded, the image parameter is set, in case of error,
261
+ * error parameter is set with the error. The last parameter is always YES
262
+ * if SDWebImageDownloaderProgressiveLoad isn't use. With the
263
+ * SDWebImageDownloaderProgressiveLoad option, this block is called
264
+ * repeatedly with the partial image object and the finished argument set to NO
265
+ * before to be called a last time with the full image and finished argument
266
+ * set to YES. In case of error, the finished argument is always YES.
267
+ *
268
+ * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation
269
+ */
270
+ - (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url
271
+ options:(SDWebImageDownloaderOptions)options
272
+ progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
273
+ completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;
274
+
275
+ /**
276
+ * Creates a SDWebImageDownloader async downloader instance with a given URL
277
+ *
278
+ * The delegate will be informed when the image is finish downloaded or an error has happen.
279
+ *
280
+ * @see SDWebImageDownloaderDelegate
281
+ *
282
+ * @param url The URL to the image to download
283
+ * @param options The options to be used for this download
284
+ * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
285
+ * @param progressBlock A block called repeatedly while the image is downloading
286
+ * @note the progress block is executed on a background queue
287
+ * @param completedBlock A block called once the download is completed.
288
+ *
289
+ * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation
290
+ */
291
+ - (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url
292
+ options:(SDWebImageDownloaderOptions)options
293
+ context:(nullable SDWebImageContext *)context
294
+ progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
295
+ completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;
296
+
297
+ /**
298
+ * Cancels all download operations in the queue
299
+ */
300
+ - (void)cancelAllDownloads;
301
+
302
+ /**
303
+ * Invalidates the managed session, optionally canceling pending operations.
304
+ * @note If you use custom downloader instead of the shared downloader, you need call this method when you do not use it to avoid memory leak
305
+ * @param cancelPendingOperations Whether or not to cancel pending operations.
306
+ * @note Calling this method on the shared downloader has no effect.
307
+ */
308
+ - (void)invalidateSessionAndCancel:(BOOL)cancelPendingOperations;
309
+
310
+ @end
311
+
312
+
313
+ /**
314
+ SDWebImageDownloader is the built-in image loader conform to `SDImageLoader`. Which provide the HTTP/HTTPS/FTP download, or local file URL using NSURLSession.
315
+ However, this downloader class itself also support customization for advanced users. You can specify `operationClass` in download config to custom download operation, See `SDWebImageDownloaderOperation`.
316
+ If you want to provide some image loader which beyond network or local file, consider to create your own custom class conform to `SDImageLoader`.
317
+ */
318
+ @interface SDWebImageDownloader (SDImageLoader) <SDImageLoader>
319
+
320
+ @end
@@ -0,0 +1,113 @@
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code.
7
+ */
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "SDWebImageCompat.h"
11
+
12
+ /// Operation execution order
13
+ typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) {
14
+ /**
15
+ * Default value. All download operations will execute in queue style (first-in-first-out).
16
+ */
17
+ SDWebImageDownloaderFIFOExecutionOrder,
18
+
19
+ /**
20
+ * All download operations will execute in stack style (last-in-first-out).
21
+ */
22
+ SDWebImageDownloaderLIFOExecutionOrder
23
+ };
24
+
25
+ /**
26
+ The class contains all the config for image downloader
27
+ @note This class conform to NSCopying, make sure to add the property in `copyWithZone:` as well.
28
+ */
29
+ @interface SDWebImageDownloaderConfig : NSObject <NSCopying>
30
+
31
+ /**
32
+ Gets the default downloader config used for shared instance or initialization when it does not provide any downloader config. Such as `SDWebImageDownloader.sharedDownloader`.
33
+ @note You can modify the property on default downloader config, which can be used for later created downloader instance. The already created downloader instance does not get affected.
34
+ */
35
+ @property (nonatomic, class, readonly, nonnull) SDWebImageDownloaderConfig *defaultDownloaderConfig;
36
+
37
+ /**
38
+ * The maximum number of concurrent downloads.
39
+ * Defaults to 6.
40
+ */
41
+ @property (nonatomic, assign) NSInteger maxConcurrentDownloads;
42
+
43
+ /**
44
+ * The timeout value (in seconds) for each download operation.
45
+ * Defaults to 15.0.
46
+ */
47
+ @property (nonatomic, assign) NSTimeInterval downloadTimeout;
48
+
49
+ /**
50
+ * The minimum interval about progress percent during network downloading. Which means the next progress callback and current progress callback's progress percent difference should be larger or equal to this value. However, the final finish download progress callback does not get effected.
51
+ * The value should be 0.0-1.0.
52
+ * @note If you're using progressive decoding feature, this will also effect the image refresh rate.
53
+ * @note This value may enhance the performance if you don't want progress callback too frequently.
54
+ * Defaults to 0, which means each time we receive the new data from URLSession, we callback the progressBlock immediately.
55
+ */
56
+ @property (nonatomic, assign) double minimumProgressInterval;
57
+
58
+ /**
59
+ * The custom session configuration in use by NSURLSession. If you don't provide one, we will use `defaultSessionConfiguration` instead.
60
+ * Defatuls to nil.
61
+ * @note This property does not support dynamic changes, means it's immutable after the downloader instance initialized.
62
+ */
63
+ @property (nonatomic, strong, nullable) NSURLSessionConfiguration *sessionConfiguration;
64
+
65
+ /**
66
+ * Gets/Sets a subclass of `SDWebImageDownloaderOperation` as the default
67
+ * `NSOperation` to be used each time SDWebImage constructs a request
68
+ * operation to download an image.
69
+ * Defaults to nil.
70
+ * @note Passing `NSOperation<SDWebImageDownloaderOperation>` to set as default. Passing `nil` will revert to `SDWebImageDownloaderOperation`.
71
+ */
72
+ @property (nonatomic, assign, nullable) Class operationClass;
73
+
74
+ /**
75
+ * Changes download operations execution order.
76
+ * Defaults to `SDWebImageDownloaderFIFOExecutionOrder`.
77
+ */
78
+ @property (nonatomic, assign) SDWebImageDownloaderExecutionOrder executionOrder;
79
+
80
+ /**
81
+ * Set the default URL credential to be set for request operations.
82
+ * Defaults to nil.
83
+ */
84
+ @property (nonatomic, copy, nullable) NSURLCredential *urlCredential;
85
+
86
+ /**
87
+ * Set username using for HTTP Basic authentication.
88
+ * Defaults to nil.
89
+ */
90
+ @property (nonatomic, copy, nullable) NSString *username;
91
+
92
+ /**
93
+ * Set password using for HTTP Basic authentication.
94
+ * Defaults to nil.
95
+ */
96
+ @property (nonatomic, copy, nullable) NSString *password;
97
+
98
+ /**
99
+ * Set the acceptable HTTP Response status code. The status code which beyond the range will mark the download operation failed.
100
+ * For example, if we config [200, 400) but server response is 503, the download will fail with error code `SDWebImageErrorInvalidDownloadStatusCode`.
101
+ * Defaults to [200,400). Nil means no validation at all.
102
+ */
103
+ @property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes;
104
+
105
+ /**
106
+ * Set the acceptable HTTP Response content type. The content type beyond the set will mark the download operation failed.
107
+ * For example, if we config ["image/png"] but server response is "application/json", the download will fail with error code `SDWebImageErrorInvalidDownloadContentType`.
108
+ * Normally you don't need this for image format detection because we use image's data file signature magic bytes: https://en.wikipedia.org/wiki/List_of_file_signatures
109
+ * Defaults to nil. Nil means no validation at all.
110
+ */
111
+ @property (nonatomic, copy, nullable) NSSet<NSString *> *acceptableContentTypes;
112
+
113
+ @end
@@ -0,0 +1,52 @@
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code.
7
+ */
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "SDWebImageCompat.h"
11
+
12
+ typedef NSData * _Nullable (^SDWebImageDownloaderDecryptorBlock)(NSData * _Nonnull data, NSURLResponse * _Nullable response);
13
+
14
+ /**
15
+ This is the protocol for downloader decryptor. Which decrypt the original encrypted data before decoding. Note progressive decoding is not compatible for decryptor.
16
+ We can use a block to specify the downloader decryptor. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.
17
+ */
18
+ @protocol SDWebImageDownloaderDecryptor <NSObject>
19
+
20
+ /// Decrypt the original download data and return a new data. You can use this to decrypt the data using your preferred algorithm.
21
+ /// @param data The original download data
22
+ /// @param response The URL response for data. If you modify the original URL response via response modifier, the modified version will be here. This arg is nullable.
23
+ /// @note If nil is returned, the image download will be marked as failed with error `SDWebImageErrorBadImageData`
24
+ - (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response;
25
+
26
+ @end
27
+
28
+ /**
29
+ A downloader response modifier class with block.
30
+ */
31
+ @interface SDWebImageDownloaderDecryptor : NSObject <SDWebImageDownloaderDecryptor>
32
+
33
+ /// Create the data decryptor with block
34
+ /// @param block A block to control decrypt logic
35
+ - (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block;
36
+
37
+ /// Create the data decryptor with block
38
+ /// @param block A block to control decrypt logic
39
+ + (nonnull instancetype)decryptorWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block;
40
+
41
+ - (nonnull instancetype)init NS_UNAVAILABLE;
42
+ + (nonnull instancetype)new NS_UNAVAILABLE;
43
+
44
+ @end
45
+
46
+ /// Convenience way to create decryptor for common data encryption.
47
+ @interface SDWebImageDownloaderDecryptor (Conveniences)
48
+
49
+ /// Base64 Encoded image data decryptor
50
+ @property (class, readonly, nonnull) SDWebImageDownloaderDecryptor *base64Decryptor;
51
+
52
+ @end
@@ -0,0 +1,191 @@
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code.
7
+ */
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "SDWebImageDownloader.h"
11
+ #import "SDWebImageOperation.h"
12
+
13
+ /**
14
+ Describes a downloader operation. If one wants to use a custom downloader op, it needs to inherit from `NSOperation` and conform to this protocol
15
+ For the description about these methods, see `SDWebImageDownloaderOperation`
16
+ @note If your custom operation class does not use `NSURLSession` at all, do not implement the optional methods and session delegate methods.
17
+ */
18
+ @protocol SDWebImageDownloaderOperation <NSURLSessionTaskDelegate, NSURLSessionDataDelegate>
19
+ @required
20
+ - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request
21
+ inSession:(nullable NSURLSession *)session
22
+ options:(SDWebImageDownloaderOptions)options;
23
+
24
+ - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request
25
+ inSession:(nullable NSURLSession *)session
26
+ options:(SDWebImageDownloaderOptions)options
27
+ context:(nullable SDWebImageContext *)context;
28
+
29
+ - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
30
+ completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;
31
+
32
+ - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
33
+ completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock
34
+ decodeOptions:(nullable SDImageCoderOptions *)decodeOptions;
35
+
36
+ - (BOOL)cancel:(nullable id)token;
37
+
38
+ @property (strong, nonatomic, readonly, nullable) NSURLRequest *request;
39
+ @property (strong, nonatomic, readonly, nullable) NSURLResponse *response;
40
+
41
+ @optional
42
+ @property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask;
43
+ @property (strong, nonatomic, readonly, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0));
44
+
45
+ // These operation-level config was inherited from downloader. See `SDWebImageDownloaderConfig` for documentation.
46
+ @property (strong, nonatomic, nullable) NSURLCredential *credential;
47
+ @property (assign, nonatomic) double minimumProgressInterval;
48
+ @property (copy, nonatomic, nullable) NSIndexSet *acceptableStatusCodes;
49
+ @property (copy, nonatomic, nullable) NSSet<NSString *> *acceptableContentTypes;
50
+
51
+ @end
52
+
53
+
54
+ /**
55
+ The download operation class for SDWebImageDownloader.
56
+ */
57
+ @interface SDWebImageDownloaderOperation : NSOperation <SDWebImageDownloaderOperation>
58
+
59
+ /**
60
+ * The request used by the operation's task.
61
+ */
62
+ @property (strong, nonatomic, readonly, nullable) NSURLRequest *request;
63
+
64
+ /**
65
+ * The response returned by the operation's task.
66
+ */
67
+ @property (strong, nonatomic, readonly, nullable) NSURLResponse *response;
68
+
69
+ /**
70
+ * The operation's task
71
+ */
72
+ @property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask;
73
+
74
+ /**
75
+ * The collected metrics from `-URLSession:task:didFinishCollectingMetrics:`.
76
+ * This can be used to collect the network metrics like download duration, DNS lookup duration, SSL handshake duration, etc. See Apple's documentation: https://developer.apple.com/documentation/foundation/urlsessiontaskmetrics
77
+ */
78
+ @property (strong, nonatomic, readonly, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0));
79
+
80
+ /**
81
+ * The credential used for authentication challenges in `-URLSession:task:didReceiveChallenge:completionHandler:`.
82
+ *
83
+ * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present.
84
+ */
85
+ @property (strong, nonatomic, nullable) NSURLCredential *credential;
86
+
87
+ /**
88
+ * The minimum interval about progress percent during network downloading. Which means the next progress callback and current progress callback's progress percent difference should be larger or equal to this value. However, the final finish download progress callback does not get effected.
89
+ * The value should be 0.0-1.0.
90
+ * @note If you're using progressive decoding feature, this will also effect the image refresh rate.
91
+ * @note This value may enhance the performance if you don't want progress callback too frequently.
92
+ * Defaults to 0, which means each time we receive the new data from URLSession, we callback the progressBlock immediately.
93
+ */
94
+ @property (assign, nonatomic) double minimumProgressInterval;
95
+
96
+ /**
97
+ * Set the acceptable HTTP Response status code. The status code which beyond the range will mark the download operation failed.
98
+ * For example, if we config [200, 400) but server response is 503, the download will fail with error code `SDWebImageErrorInvalidDownloadStatusCode`.
99
+ * Defaults to [200,400). Nil means no validation at all.
100
+ */
101
+ @property (copy, nonatomic, nullable) NSIndexSet *acceptableStatusCodes;
102
+
103
+ /**
104
+ * Set the acceptable HTTP Response content type. The content type beyond the set will mark the download operation failed.
105
+ * For example, if we config ["image/png"] but server response is "application/json", the download will fail with error code `SDWebImageErrorInvalidDownloadContentType`.
106
+ * Normally you don't need this for image format detection because we use image's data file signature magic bytes: https://en.wikipedia.org/wiki/List_of_file_signatures
107
+ * Defaults to nil. Nil means no validation at all.
108
+ */
109
+ @property (copy, nonatomic, nullable) NSSet<NSString *> *acceptableContentTypes;
110
+
111
+ /**
112
+ * The options for the receiver.
113
+ */
114
+ @property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options;
115
+
116
+ /**
117
+ * The context for the receiver.
118
+ */
119
+ @property (copy, nonatomic, readonly, nullable) SDWebImageContext *context;
120
+
121
+ /**
122
+ * Initializes a `SDWebImageDownloaderOperation` object
123
+ *
124
+ * @see SDWebImageDownloaderOperation
125
+ *
126
+ * @param request the URL request
127
+ * @param session the URL session in which this operation will run
128
+ * @param options downloader options
129
+ *
130
+ * @return the initialized instance
131
+ */
132
+ - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request
133
+ inSession:(nullable NSURLSession *)session
134
+ options:(SDWebImageDownloaderOptions)options;
135
+
136
+ /**
137
+ * Initializes a `SDWebImageDownloaderOperation` object
138
+ *
139
+ * @see SDWebImageDownloaderOperation
140
+ *
141
+ * @param request the URL request
142
+ * @param session the URL session in which this operation will run
143
+ * @param options downloader options
144
+ * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
145
+ *
146
+ * @return the initialized instance
147
+ */
148
+ - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request
149
+ inSession:(nullable NSURLSession *)session
150
+ options:(SDWebImageDownloaderOptions)options
151
+ context:(nullable SDWebImageContext *)context NS_DESIGNATED_INITIALIZER;
152
+
153
+ /**
154
+ * Adds handlers for progress and completion. Returns a token that can be passed to -cancel: to cancel this set of
155
+ * callbacks.
156
+ *
157
+ * @param progressBlock the block executed when a new chunk of data arrives.
158
+ * @note the progress block is executed on a background queue
159
+ * @param completedBlock the block executed when the download is done.
160
+ * @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue
161
+ *
162
+ * @return the token to use to cancel this set of handlers
163
+ */
164
+ - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
165
+ completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;
166
+
167
+ /**
168
+ * Adds handlers for progress and completion, and optional decode options (which need another image other than the initial one). Returns a token that can be passed to -cancel: to cancel this set of
169
+ * callbacks.
170
+ *
171
+ * @param progressBlock the block executed when a new chunk of data arrives.
172
+ * @note the progress block is executed on a background queue
173
+ * @param completedBlock the block executed when the download is done.
174
+ * @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue
175
+ * @param decodeOptions The optional decode options, used when in thumbnail decoding for current completion block callback. For example, request <url1, {thumbnail: 100x100}> and then <url1, {thumbnail: 200x200}>, we may callback these two completion block with different size.
176
+ * @return the token to use to cancel this set of handlers
177
+ */
178
+ - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
179
+ completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock
180
+ decodeOptions:(nullable SDImageCoderOptions *)decodeOptions;
181
+
182
+ /**
183
+ * Cancels a set of callbacks. Once all callbacks are canceled, the operation is cancelled.
184
+ *
185
+ * @param token the token representing a set of callbacks to cancel
186
+ *
187
+ * @return YES if the operation was stopped because this was the last token to be canceled. NO otherwise.
188
+ */
189
+ - (BOOL)cancel:(nullable id)token;
190
+
191
+ @end