@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,72 @@
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 NSURLRequest * _Nullable (^SDWebImageDownloaderRequestModifierBlock)(NSURLRequest * _Nonnull request);
13
+
14
+ /**
15
+ This is the protocol for downloader request modifier.
16
+ We can use a block to specify the downloader request modifier. 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 SDWebImageDownloaderRequestModifier <NSObject>
19
+
20
+ /// Modify the original URL request and return a new one instead. You can modify the HTTP header, cachePolicy, etc for this URL.
21
+ /// @param request The original URL request for image loading
22
+ /// @note If return nil, the URL request will be cancelled.
23
+ - (nullable NSURLRequest *)modifiedRequestWithRequest:(nonnull NSURLRequest *)request;
24
+
25
+ @end
26
+
27
+ /**
28
+ A downloader request modifier class with block.
29
+ */
30
+ @interface SDWebImageDownloaderRequestModifier : NSObject <SDWebImageDownloaderRequestModifier>
31
+
32
+ /// Create the request modifier with block
33
+ /// @param block A block to control modifier logic
34
+ - (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block;
35
+
36
+ /// Create the request modifier with block
37
+ /// @param block A block to control modifier logic
38
+ + (nonnull instancetype)requestModifierWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block;
39
+
40
+ - (nonnull instancetype)init NS_UNAVAILABLE;
41
+ + (nonnull instancetype)new NS_UNAVAILABLE;
42
+
43
+ @end
44
+
45
+ /**
46
+ A convenient request modifier to provide the HTTP request including HTTP Method, Headers and Body.
47
+ */
48
+ @interface SDWebImageDownloaderRequestModifier (Conveniences)
49
+
50
+ /// Create the request modifier with HTTP Method.
51
+ /// @param method HTTP Method, nil means to GET.
52
+ /// @note This is for convenience, if you need code to control the logic, use block API instead.
53
+ - (nonnull instancetype)initWithMethod:(nullable NSString *)method;
54
+
55
+ /// Create the request modifier with HTTP Headers.
56
+ /// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original request.
57
+ /// @note This is for convenience, if you need code to control the logic, use block API instead.
58
+ - (nonnull instancetype)initWithHeaders:(nullable NSDictionary<NSString *, NSString *> *)headers;
59
+
60
+ /// Create the request modifier with HTTP Body.
61
+ /// @param body HTTP Body.
62
+ /// @note This is for convenience, if you need code to control the logic, use block API instead.
63
+ - (nonnull instancetype)initWithBody:(nullable NSData *)body;
64
+
65
+ /// Create the request modifier with HTTP Method, Headers and Body.
66
+ /// @param method HTTP Method, nil means to GET.
67
+ /// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original request.
68
+ /// @param body HTTP Body.
69
+ /// @note This is for convenience, if you need code to control the logic, use block API instead.
70
+ - (nonnull instancetype)initWithMethod:(nullable NSString *)method headers:(nullable NSDictionary<NSString *, NSString *> *)headers body:(nullable NSData *)body;
71
+
72
+ @end
@@ -0,0 +1,72 @@
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 NSURLResponse * _Nullable (^SDWebImageDownloaderResponseModifierBlock)(NSURLResponse * _Nonnull response);
13
+
14
+ /**
15
+ This is the protocol for downloader response modifier.
16
+ We can use a block to specify the downloader response modifier. 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 SDWebImageDownloaderResponseModifier <NSObject>
19
+
20
+ /// Modify the original URL response and return a new response. You can use this to check MIME-Type, mock server response, etc.
21
+ /// @param response The original URL response, note for HTTP request it's actually a `NSHTTPURLResponse` instance
22
+ /// @note If nil is returned, the image download will marked as cancelled with error `SDWebImageErrorInvalidDownloadResponse`
23
+ - (nullable NSURLResponse *)modifiedResponseWithResponse:(nonnull NSURLResponse *)response;
24
+
25
+ @end
26
+
27
+ /**
28
+ A downloader response modifier class with block.
29
+ */
30
+ @interface SDWebImageDownloaderResponseModifier : NSObject <SDWebImageDownloaderResponseModifier>
31
+
32
+ /// Create the response modifier with block
33
+ /// @param block A block to control modifier logic
34
+ - (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderResponseModifierBlock)block;
35
+
36
+ /// Create the response modifier with block
37
+ /// @param block A block to control modifier logic
38
+ + (nonnull instancetype)responseModifierWithBlock:(nonnull SDWebImageDownloaderResponseModifierBlock)block;
39
+
40
+ - (nonnull instancetype)init NS_UNAVAILABLE;
41
+ + (nonnull instancetype)new NS_UNAVAILABLE;
42
+
43
+ @end
44
+
45
+ /**
46
+ A convenient response modifier to provide the HTTP response including HTTP Status Code, Version and Headers.
47
+ */
48
+ @interface SDWebImageDownloaderResponseModifier (Conveniences)
49
+
50
+ /// Create the response modifier with HTTP Status code.
51
+ /// @param statusCode HTTP Status Code.
52
+ /// @note This is for convenience, if you need code to control the logic, use block API instead.
53
+ - (nonnull instancetype)initWithStatusCode:(NSInteger)statusCode;
54
+
55
+ /// Create the response modifier with HTTP Version. Status code defaults to 200.
56
+ /// @param version HTTP Version, nil means "HTTP/1.1".
57
+ /// @note This is for convenience, if you need code to control the logic, use block API instead.
58
+ - (nonnull instancetype)initWithVersion:(nullable NSString *)version;
59
+
60
+ /// Create the response modifier with HTTP Headers. Status code defaults to 200.
61
+ /// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original response.
62
+ /// @note This is for convenience, if you need code to control the logic, use block API instead.
63
+ - (nonnull instancetype)initWithHeaders:(nullable NSDictionary<NSString *, NSString *> *)headers;
64
+
65
+ /// Create the response modifier with HTTP Status Code, Version and Headers.
66
+ /// @param statusCode HTTP Status Code.
67
+ /// @param version HTTP Version, nil means "HTTP/1.1".
68
+ /// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original response.
69
+ /// @note This is for convenience, if you need code to control the logic, use block API instead.
70
+ - (nonnull instancetype)initWithStatusCode:(NSInteger)statusCode version:(nullable NSString *)version headers:(nullable NSDictionary<NSString *, NSString *> *)headers;
71
+
72
+ @end
@@ -0,0 +1,33 @@
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ * (c) Jamie Pinkham
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+
10
+ #import "SDWebImageCompat.h"
11
+
12
+ /// An error domain represent SDWebImage loading system with custom codes
13
+ FOUNDATION_EXPORT NSErrorDomain const _Nonnull SDWebImageErrorDomain;
14
+
15
+ /// The response instance for invalid download response (NSURLResponse *)
16
+ FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadResponseKey;
17
+ /// The HTTP status code for invalid download response (NSNumber *)
18
+ FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey;
19
+ /// The HTTP MIME content type for invalid download response (NSString *)
20
+ FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadContentTypeKey;
21
+
22
+ /// SDWebImage error domain and codes
23
+ typedef NS_ERROR_ENUM(SDWebImageErrorDomain, SDWebImageError) {
24
+ SDWebImageErrorInvalidURL = 1000, // The URL is invalid, such as nil URL or corrupted URL
25
+ SDWebImageErrorBadImageData = 1001, // The image data can not be decoded to image, or the image data is empty
26
+ SDWebImageErrorCacheNotModified = 1002, // The remote location specify that the cached image is not modified, such as the HTTP response 304 code. It's useful for `SDWebImageRefreshCached`
27
+ SDWebImageErrorBlackListed = 1003, // The URL is blacklisted because of unrecoverable failure marked by downloader (such as 404), you can use `.retryFailed` option to avoid this
28
+ SDWebImageErrorInvalidDownloadOperation = 2000, // The image download operation is invalid, such as nil operation or unexpected error occur when operation initialized
29
+ SDWebImageErrorInvalidDownloadStatusCode = 2001, // The image download response a invalid status code. You can check the status code in error's userInfo under `SDWebImageErrorDownloadStatusCodeKey`
30
+ SDWebImageErrorCancelled = 2002, // The image loading operation is cancelled before finished, during either async disk cache query, or waiting before actual network request. For actual network request error, check `NSURLErrorDomain` error domain and code.
31
+ SDWebImageErrorInvalidDownloadResponse = 2003, // When using response modifier, the modified download response is nil and marked as failed.
32
+ SDWebImageErrorInvalidDownloadContentType = 2004, // The image download response a invalid content type. You can check the MIME content type in error's userInfo under `SDWebImageErrorDownloadContentTypeKey`
33
+ };
@@ -0,0 +1,119 @@
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 "SDWebImageCompat.h"
10
+
11
+ #if SD_UIKIT || SD_MAC
12
+
13
+ /**
14
+ A protocol to custom the indicator during the image loading.
15
+ All of these methods are called from main queue.
16
+ */
17
+ @protocol SDWebImageIndicator <NSObject>
18
+
19
+ @required
20
+ /**
21
+ The view associate to the indicator.
22
+
23
+ @return The indicator view
24
+ */
25
+ @property (nonatomic, strong, readonly, nonnull) UIView *indicatorView;
26
+
27
+ /**
28
+ Start the animating for indicator.
29
+ */
30
+ - (void)startAnimatingIndicator;
31
+
32
+ /**
33
+ Stop the animating for indicator.
34
+ */
35
+ - (void)stopAnimatingIndicator;
36
+
37
+ @optional
38
+ /**
39
+ Update the loading progress (0-1.0) for indicator. Optional
40
+
41
+ @param progress The progress, value between 0 and 1.0
42
+ */
43
+ - (void)updateIndicatorProgress:(double)progress;
44
+
45
+ @end
46
+
47
+ #pragma mark - Activity Indicator
48
+
49
+ /**
50
+ Activity indicator class.
51
+ for UIKit(macOS), it use a `UIActivityIndicatorView`.
52
+ for AppKit(macOS), it use a `NSProgressIndicator` with the spinning style.
53
+ */
54
+ @interface SDWebImageActivityIndicator : NSObject <SDWebImageIndicator>
55
+
56
+ #if SD_UIKIT
57
+ @property (nonatomic, strong, readonly, nonnull) UIActivityIndicatorView *indicatorView;
58
+ #else
59
+ @property (nonatomic, strong, readonly, nonnull) NSProgressIndicator *indicatorView;
60
+ #endif
61
+
62
+ @end
63
+
64
+ /**
65
+ Convenience way to use activity indicator.
66
+ */
67
+ @interface SDWebImageActivityIndicator (Conveniences)
68
+
69
+ #if !SD_VISION
70
+ /// These indicator use the fixed color without dark mode support
71
+ /// gray-style activity indicator
72
+ @property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *grayIndicator;
73
+ /// large gray-style activity indicator
74
+ @property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *grayLargeIndicator;
75
+ /// white-style activity indicator
76
+ @property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *whiteIndicator;
77
+ /// large white-style activity indicator
78
+ @property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *whiteLargeIndicator;
79
+ #endif
80
+ /// These indicator use the system style, supports dark mode if available (iOS 13+/macOS 10.14+)
81
+ /// large activity indicator
82
+ @property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *largeIndicator;
83
+ /// medium activity indicator
84
+ @property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *mediumIndicator;
85
+
86
+ @end
87
+
88
+ #pragma mark - Progress Indicator
89
+
90
+ /**
91
+ Progress indicator class.
92
+ for UIKit(macOS), it use a `UIProgressView`.
93
+ for AppKit(macOS), it use a `NSProgressIndicator` with the bar style.
94
+ */
95
+ @interface SDWebImageProgressIndicator : NSObject <SDWebImageIndicator>
96
+
97
+ #if SD_UIKIT
98
+ @property (nonatomic, strong, readonly, nonnull) UIProgressView *indicatorView;
99
+ #else
100
+ @property (nonatomic, strong, readonly, nonnull) NSProgressIndicator *indicatorView;
101
+ #endif
102
+
103
+ @end
104
+
105
+ /**
106
+ Convenience way to create progress indicator. Remember to specify the indicator width or use layout constraint if need.
107
+ */
108
+ @interface SDWebImageProgressIndicator (Conveniences)
109
+
110
+ /// default-style progress indicator
111
+ @property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *defaultIndicator;
112
+ #if SD_UIKIT
113
+ /// bar-style progress indicator
114
+ @property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *barIndicator API_UNAVAILABLE(tvos);
115
+ #endif
116
+
117
+ @end
118
+
119
+ #endif
@@ -0,0 +1,290 @@
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 "SDWebImageCompat.h"
10
+ #import "SDWebImageOperation.h"
11
+ #import "SDImageCacheDefine.h"
12
+ #import "SDImageLoader.h"
13
+ #import "SDImageTransformer.h"
14
+ #import "SDWebImageCacheKeyFilter.h"
15
+ #import "SDWebImageCacheSerializer.h"
16
+ #import "SDWebImageOptionsProcessor.h"
17
+
18
+ typedef void(^SDExternalCompletionBlock)(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL);
19
+
20
+ typedef void(^SDInternalCompletionBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL);
21
+
22
+ /**
23
+ A combined operation representing the cache and loader operation. You can use it to cancel the load process.
24
+ */
25
+ @interface SDWebImageCombinedOperation : NSObject <SDWebImageOperation>
26
+
27
+ /**
28
+ Cancel the current operation, including cache and loader process
29
+ */
30
+ - (void)cancel;
31
+
32
+ /// Whether the operation has been cancelled.
33
+ @property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled;
34
+
35
+ /**
36
+ The cache operation from the image cache query
37
+ */
38
+ @property (strong, nonatomic, nullable, readonly) id<SDWebImageOperation> cacheOperation;
39
+
40
+ /**
41
+ The loader operation from the image loader (such as download operation)
42
+ */
43
+ @property (strong, nonatomic, nullable, readonly) id<SDWebImageOperation> loaderOperation;
44
+
45
+ @end
46
+
47
+
48
+ @class SDWebImageManager;
49
+
50
+ /**
51
+ The manager delegate protocol.
52
+ */
53
+ @protocol SDWebImageManagerDelegate <NSObject>
54
+
55
+ @optional
56
+
57
+ /**
58
+ * Controls which image should be downloaded when the image is not found in the cache.
59
+ *
60
+ * @param imageManager The current `SDWebImageManager`
61
+ * @param imageURL The url of the image to be downloaded
62
+ *
63
+ * @return Return NO to prevent the downloading of the image on cache misses. If not implemented, YES is implied.
64
+ */
65
+ - (BOOL)imageManager:(nonnull SDWebImageManager *)imageManager shouldDownloadImageForURL:(nonnull NSURL *)imageURL;
66
+
67
+ /**
68
+ * Controls the complicated logic to mark as failed URLs when download error occur.
69
+ * If the delegate implement this method, we will not use the built-in way to mark URL as failed based on error code;
70
+ @param imageManager The current `SDWebImageManager`
71
+ @param imageURL The url of the image
72
+ @param error The download error for the url
73
+ @return Whether to block this url or not. Return YES to mark this URL as failed.
74
+ */
75
+ - (BOOL)imageManager:(nonnull SDWebImageManager *)imageManager shouldBlockFailedURL:(nonnull NSURL *)imageURL withError:(nonnull NSError *)error;
76
+
77
+ @end
78
+
79
+ /**
80
+ * The SDWebImageManager is the class behind the UIImageView+WebCache category and likes.
81
+ * It ties the asynchronous downloader (SDWebImageDownloader) with the image cache store (SDImageCache).
82
+ * You can use this class directly to benefit from web image downloading with caching in another context than
83
+ * a UIView.
84
+ *
85
+ * Here is a simple example of how to use SDWebImageManager:
86
+ *
87
+ * @code
88
+
89
+ SDWebImageManager *manager = [SDWebImageManager sharedManager];
90
+ [manager loadImageWithURL:imageURL
91
+ options:0
92
+ progress:nil
93
+ completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
94
+ if (image) {
95
+ // do something with image
96
+ }
97
+ }];
98
+
99
+ * @endcode
100
+ */
101
+ @interface SDWebImageManager : NSObject
102
+
103
+ /**
104
+ * The delegate for manager. Defaults to nil.
105
+ */
106
+ @property (weak, nonatomic, nullable) id <SDWebImageManagerDelegate> delegate;
107
+
108
+ /**
109
+ * The image cache used by manager to query image cache.
110
+ */
111
+ @property (strong, nonatomic, readonly, nonnull) id<SDImageCache> imageCache;
112
+
113
+ /**
114
+ * The image loader used by manager to load image.
115
+ */
116
+ @property (strong, nonatomic, readonly, nonnull) id<SDImageLoader> imageLoader;
117
+
118
+ /**
119
+ The image transformer for manager. It's used for image transform after the image load finished and store the transformed image to cache, see `SDImageTransformer`.
120
+ Defaults to nil, which means no transform is applied.
121
+ @note This will affect all the load requests for this manager if you provide. However, you can pass `SDWebImageContextImageTransformer` in context arg to explicitly use that transformer instead.
122
+ */
123
+ @property (strong, nonatomic, nullable) id<SDImageTransformer> transformer;
124
+
125
+ /**
126
+ * The cache filter is used to convert an URL into a cache key each time SDWebImageManager need cache key to use image cache.
127
+ *
128
+ * The following example sets a filter in the application delegate that will remove any query-string from the
129
+ * URL before to use it as a cache key:
130
+ *
131
+ * @code
132
+ SDWebImageManager.sharedManager.cacheKeyFilter =[SDWebImageCacheKeyFilter cacheKeyFilterWithBlock:^NSString * _Nullable(NSURL * _Nonnull url) {
133
+ url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path];
134
+ return [url absoluteString];
135
+ }];
136
+ * @endcode
137
+ */
138
+ @property (nonatomic, strong, nullable) id<SDWebImageCacheKeyFilter> cacheKeyFilter;
139
+
140
+ /**
141
+ * The cache serializer is used to convert the decoded image, the source downloaded data, to the actual data used for storing to the disk cache. If you return nil, means to generate the data from the image instance, see `SDImageCache`.
142
+ * For example, if you are using WebP images and facing the slow decoding time issue when later retrieving from disk cache again. You can try to encode the decoded image to JPEG/PNG format to disk cache instead of source downloaded data.
143
+ * @note The `image` arg is nonnull, but when you also provide an image transformer and the image is transformed, the `data` arg may be nil, take attention to this case.
144
+ * @note This method is called from a global queue in order to not to block the main thread.
145
+ * @code
146
+ SDWebImageManager.sharedManager.cacheSerializer = [SDWebImageCacheSerializer cacheSerializerWithBlock:^NSData * _Nullable(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL) {
147
+ SDImageFormat format = [NSData sd_imageFormatForImageData:data];
148
+ switch (format) {
149
+ case SDImageFormatWebP:
150
+ return image.images ? data : nil;
151
+ default:
152
+ return data;
153
+ }
154
+ }];
155
+ * @endcode
156
+ * The default value is nil. Means we just store the source downloaded data to disk cache.
157
+ */
158
+ @property (nonatomic, strong, nullable) id<SDWebImageCacheSerializer> cacheSerializer;
159
+
160
+ /**
161
+ The options processor is used, to have a global control for all the image request options and context option for current manager.
162
+ @note If you use `transformer`, `cacheKeyFilter` or `cacheSerializer` property of manager, the input context option already apply those properties before passed. This options processor is a better replacement for those property in common usage.
163
+ For example, you can control the global options, based on the URL or original context option like the below code.
164
+
165
+ * @code
166
+ SDWebImageManager.sharedManager.optionsProcessor = [SDWebImageOptionsProcessor optionsProcessorWithBlock:^SDWebImageOptionsResult * _Nullable(NSURL * _Nullable url, SDWebImageOptions options, SDWebImageContext * _Nullable context) {
167
+ // Only do animation on `SDAnimatedImageView`
168
+ if (!context[SDWebImageContextAnimatedImageClass]) {
169
+ options |= SDWebImageDecodeFirstFrameOnly;
170
+ }
171
+ // Do not force decode for png url
172
+ if ([url.lastPathComponent isEqualToString:@"png"]) {
173
+ options |= SDWebImageAvoidDecodeImage;
174
+ }
175
+ // Always use screen scale factor
176
+ SDWebImageMutableContext *mutableContext = [NSDictionary dictionaryWithDictionary:context];
177
+ mutableContext[SDWebImageContextImageScaleFactor] = @(UIScreen.mainScreen.scale);
178
+ context = [mutableContext copy];
179
+
180
+ return [[SDWebImageOptionsResult alloc] initWithOptions:options context:context];
181
+ }];
182
+ * @endcode
183
+ */
184
+ @property (nonatomic, strong, nullable) id<SDWebImageOptionsProcessor> optionsProcessor;
185
+
186
+ /**
187
+ * Check one or more operations running
188
+ */
189
+ @property (nonatomic, assign, readonly, getter=isRunning) BOOL running;
190
+
191
+ /**
192
+ The default image cache when the manager which is created with no arguments. Such as shared manager or init.
193
+ Defaults to nil. Means using `SDImageCache.sharedImageCache`
194
+ */
195
+ @property (nonatomic, class, nullable) id<SDImageCache> defaultImageCache;
196
+
197
+ /**
198
+ The default image loader for manager which is created with no arguments. Such as shared manager or init.
199
+ Defaults to nil. Means using `SDWebImageDownloader.sharedDownloader`
200
+ */
201
+ @property (nonatomic, class, nullable) id<SDImageLoader> defaultImageLoader;
202
+
203
+ /**
204
+ * Returns global shared manager instance.
205
+ */
206
+ @property (nonatomic, class, readonly, nonnull) SDWebImageManager *sharedManager;
207
+
208
+ /**
209
+ * Allows to specify instance of cache and image loader used with image manager.
210
+ * @return new instance of `SDWebImageManager` with specified cache and loader.
211
+ */
212
+ - (nonnull instancetype)initWithCache:(nonnull id<SDImageCache>)cache loader:(nonnull id<SDImageLoader>)loader NS_DESIGNATED_INITIALIZER;
213
+
214
+ /**
215
+ * Downloads the image at the given URL if not present in cache or return the cached version otherwise.
216
+ *
217
+ * @param url The URL to the image
218
+ * @param options A mask to specify options to use for this request
219
+ * @param progressBlock A block called while image is downloading
220
+ * @note the progress block is executed on a background queue
221
+ * @param completedBlock A block called when operation has been completed.
222
+ *
223
+ * This parameter is required.
224
+ *
225
+ * This block has no return value and takes the requested UIImage as first parameter and the NSData representation as second parameter.
226
+ * In case of error the image parameter is nil and the third parameter may contain an NSError.
227
+ *
228
+ * The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache
229
+ * or from the memory cache or from the network.
230
+ *
231
+ * The fifth parameter is set to NO when the SDWebImageProgressiveLoad option is used and the image is
232
+ * downloading. This block is thus called repeatedly with a partial image. When image is fully downloaded, the
233
+ * block is called a last time with the full image and the last parameter set to YES.
234
+ *
235
+ * The last parameter is the original image URL
236
+ *
237
+ * @return Returns an instance of SDWebImageCombinedOperation, which you can cancel the loading process.
238
+ */
239
+ - (nullable SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url
240
+ options:(SDWebImageOptions)options
241
+ progress:(nullable SDImageLoaderProgressBlock)progressBlock
242
+ completed:(nonnull SDInternalCompletionBlock)completedBlock;
243
+
244
+ /**
245
+ * Downloads the image at the given URL if not present in cache or return the cached version otherwise.
246
+ *
247
+ * @param url The URL to the image
248
+ * @param options A mask to specify options to use for this request
249
+ * @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.
250
+ * @param progressBlock A block called while image is downloading
251
+ * @note the progress block is executed on a background queue
252
+ * @param completedBlock A block called when operation has been completed.
253
+ *
254
+ * @return Returns an instance of SDWebImageCombinedOperation, which you can cancel the loading process.
255
+ */
256
+ - (nullable SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url
257
+ options:(SDWebImageOptions)options
258
+ context:(nullable SDWebImageContext *)context
259
+ progress:(nullable SDImageLoaderProgressBlock)progressBlock
260
+ completed:(nonnull SDInternalCompletionBlock)completedBlock;
261
+
262
+ /**
263
+ * Cancel all current operations
264
+ */
265
+ - (void)cancelAll;
266
+
267
+ /**
268
+ * Remove the specify URL from failed black list.
269
+ * @param url The failed URL.
270
+ */
271
+ - (void)removeFailedURL:(nonnull NSURL *)url;
272
+
273
+ /**
274
+ * Remove all the URL from failed black list.
275
+ */
276
+ - (void)removeAllFailedURLs;
277
+
278
+ /**
279
+ * Return the cache key for a given URL, does not considerate transformer or thumbnail.
280
+ * @note This method does not have context option, only use the url and manager level cacheKeyFilter to generate the cache key.
281
+ */
282
+ - (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url;
283
+
284
+ /**
285
+ * Return the cache key for a given URL and context option.
286
+ * @note The context option like `.thumbnailPixelSize` and `.imageTransformer` will effect the generated cache key, using this if you have those context associated.
287
+ */
288
+ - (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url context:(nullable SDWebImageContext *)context;
289
+
290
+ @end
@@ -0,0 +1,27 @@
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
+
11
+ /// A protocol represents cancelable operation.
12
+ @protocol SDWebImageOperation <NSObject>
13
+
14
+ /// Cancel the operation
15
+ - (void)cancel;
16
+
17
+ @optional
18
+
19
+ /// Whether the operation has been cancelled.
20
+ @property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled;
21
+
22
+ @end
23
+
24
+ /// NSOperation conform to `SDWebImageOperation`.
25
+ @interface NSOperation (SDWebImageOperation) <SDWebImageOperation>
26
+
27
+ @end