@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,84 @@
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
+ /**
12
+ These following class are provided to use `UIGraphicsImageRenderer` with polyfill, which allows write cross-platform(AppKit/UIKit) code and avoid runtime version check.
13
+ Compared to `UIGraphicsBeginImageContext`, `UIGraphicsImageRenderer` use dynamic bitmap from your draw code to generate CGContext, not always use ARGB8888, which is more performant on RAM usage.
14
+ Which means, if you draw CGImage/CIImage which contains grayscale only, the underlaying bitmap context use grayscale, it's managed by system and not a fixed type. (actually, the `kCGContextTypeAutomatic`)
15
+ For usage, See more in Apple's documentation: https://developer.apple.com/documentation/uikit/uigraphicsimagerenderer
16
+ For UIKit on iOS/tvOS 10+, these method just use the same `UIGraphicsImageRenderer` API.
17
+ For others (macOS/watchOS or iOS/tvOS 10-), these method use the `SDImageGraphics.h` to implements the same behavior (but without dynamic bitmap support)
18
+ */
19
+
20
+ /// A closure for drawing an image.
21
+ typedef void (^SDGraphicsImageDrawingActions)(CGContextRef _Nonnull context);
22
+ /// Constants that specify the color range of the image renderer context.
23
+ typedef NS_ENUM(NSInteger, SDGraphicsImageRendererFormatRange) {
24
+ /// The image renderer context doesn’t specify a color range.
25
+ SDGraphicsImageRendererFormatRangeUnspecified = -1,
26
+ /// The system automatically chooses the image renderer context’s pixel format according to the color range of its content.
27
+ SDGraphicsImageRendererFormatRangeAutomatic = 0,
28
+ /// The image renderer context supports wide color.
29
+ SDGraphicsImageRendererFormatRangeExtended,
30
+ /// The image renderer context doesn’t support extended colors.
31
+ SDGraphicsImageRendererFormatRangeStandard
32
+ };
33
+
34
+ /// A set of drawing attributes that represent the configuration of an image renderer context.
35
+ @interface SDGraphicsImageRendererFormat : NSObject
36
+
37
+ #if SD_UIKIT
38
+ /// The underlying uiformat for UIKit. This usage of this API should be careful, which may cause out of sync.
39
+ @property (nonatomic, strong, nonnull) UIGraphicsImageRendererFormat *uiformat API_AVAILABLE(ios(10.0), tvos(10.0));
40
+ #endif
41
+
42
+ /// The display scale of the image renderer context.
43
+ /// The default value is equal to the scale of the main screen.
44
+ @property (nonatomic) CGFloat scale;
45
+
46
+ /// A Boolean value indicating whether the underlying Core Graphics context has an alpha channel.
47
+ /// The default value is NO.
48
+ @property (nonatomic) BOOL opaque;
49
+
50
+ /// Specifying whether the bitmap context should use extended color.
51
+ /// For iOS 12+, the value is from system `preferredRange` property
52
+ /// For iOS 10-11, the value is from system `prefersExtendedRange` property
53
+ /// For iOS 9-, the value is `.standard`
54
+ @property (nonatomic) SDGraphicsImageRendererFormatRange preferredRange;
55
+
56
+ /// Init the default format. See each properties's default value.
57
+ - (nonnull instancetype)init;
58
+
59
+ /// Returns a new format best suited for the main screen’s current configuration.
60
+ + (nonnull instancetype)preferredFormat;
61
+
62
+ @end
63
+
64
+ /// A graphics renderer for creating Core Graphics-backed images.
65
+ @interface SDGraphicsImageRenderer : NSObject
66
+
67
+ /// Creates an image renderer for drawing images of a given size.
68
+ /// @param size The size of images output from the renderer, specified in points.
69
+ /// @return An initialized image renderer.
70
+ - (nonnull instancetype)initWithSize:(CGSize)size;
71
+
72
+ /// Creates a new image renderer with a given size and format.
73
+ /// @param size The size of images output from the renderer, specified in points.
74
+ /// @param format A SDGraphicsImageRendererFormat object that encapsulates the format used to create the renderer context.
75
+ /// @return An initialized image renderer.
76
+ - (nonnull instancetype)initWithSize:(CGSize)size format:(nonnull SDGraphicsImageRendererFormat *)format;
77
+
78
+ /// Creates an image by following a set of drawing instructions.
79
+ /// @param actions A SDGraphicsImageDrawingActions block that, when invoked by the renderer, executes a set of drawing instructions to create the output image.
80
+ /// @note You should not retain or use the context outside the block, it's non-escaping.
81
+ /// @return A UIImage object created by the supplied drawing actions.
82
+ - (nonnull UIImage *)imageWithActions:(nonnull NS_NOESCAPE SDGraphicsImageDrawingActions)actions;
83
+
84
+ @end
@@ -0,0 +1,19 @@
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 "SDImageIOAnimatedCoder.h"
11
+
12
+ /**
13
+ Built in coder using ImageIO that supports APNG encoding/decoding
14
+ */
15
+ @interface SDImageAPNGCoder : SDImageIOAnimatedCoder <SDProgressiveImageCoder, SDAnimatedImageCoder>
16
+
17
+ @property (nonatomic, class, readonly, nonnull) SDImageAPNGCoder *sharedCoder;
18
+
19
+ @end
@@ -0,0 +1,23 @@
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 "SDImageIOAnimatedCoder.h"
11
+
12
+ /**
13
+ This coder is used for Google WebP and Animated WebP(AWebP) image format.
14
+ Image/IO provide the WebP decoding support in iOS 14/macOS 11/tvOS 14/watchOS 7+.
15
+ @note Currently Image/IO seems does not supports WebP encoding, if you need WebP encoding, use the custom codec below.
16
+ @note If you need to support lower firmware version for WebP, you can have a try at https://github.com/SDWebImage/SDWebImageWebPCoder
17
+ */
18
+ API_AVAILABLE(ios(14.0), tvos(14.0), macos(11.0), watchos(7.0))
19
+ @interface SDImageAWebPCoder : SDImageIOAnimatedCoder <SDProgressiveImageCoder, SDAnimatedImageCoder>
20
+
21
+ @property (nonatomic, class, readonly, nonnull) SDImageAWebPCoder *sharedCoder;
22
+
23
+ @end
@@ -0,0 +1,482 @@
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 "SDImageCacheConfig.h"
13
+ #import "SDImageCacheDefine.h"
14
+ #import "SDMemoryCache.h"
15
+ #import "SDDiskCache.h"
16
+
17
+ /// Image Cache Options
18
+ typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) {
19
+ /**
20
+ * By default, we do not query image data when the image is already cached in memory. This mask can force to query image data at the same time. However, this query is asynchronously unless you specify `SDImageCacheQueryMemoryDataSync`
21
+ */
22
+ SDImageCacheQueryMemoryData = 1 << 0,
23
+ /**
24
+ * By default, when you only specify `SDImageCacheQueryMemoryData`, we query the memory image data asynchronously. Combined this mask as well to query the memory image data synchronously.
25
+ */
26
+ SDImageCacheQueryMemoryDataSync = 1 << 1,
27
+ /**
28
+ * By default, when the memory cache miss, we query the disk cache asynchronously. This mask can force to query disk cache (when memory cache miss) synchronously.
29
+ @note These 3 query options can be combined together. For the full list about these masks combination, see wiki page.
30
+ */
31
+ SDImageCacheQueryDiskDataSync = 1 << 2,
32
+ /**
33
+ * By default, images are decoded respecting their original size. On iOS, this flag will scale down the
34
+ * images to a size compatible with the constrained memory of devices.
35
+ */
36
+ SDImageCacheScaleDownLargeImages = 1 << 3,
37
+ /**
38
+ * 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.
39
+ * 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.
40
+ * @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)
41
+ * @deprecated Deprecated in v5.17.0, if you don't want force-decode, pass [.imageForceDecodePolicy] = SDImageForceDecodePolicy.never.rawValue in context option
42
+ */
43
+ SDImageCacheAvoidDecodeImage 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 << 4,
44
+ /**
45
+ * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image.
46
+ */
47
+ SDImageCacheDecodeFirstFrameOnly = 1 << 5,
48
+ /**
49
+ * 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 disk cache
50
+ */
51
+ SDImageCachePreloadAllFrames = 1 << 6,
52
+ /**
53
+ * 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.
54
+ * Using this option, can ensure we always produce image with your provided class. If failed, an error with code `SDWebImageErrorBadImageData` will be used.
55
+ * Note this options is not compatible with `SDImageCacheDecodeFirstFrameOnly`, which always produce a UIImage/NSImage.
56
+ */
57
+ SDImageCacheMatchAnimatedImageClass = 1 << 7,
58
+ };
59
+
60
+ /**
61
+ * A token associated with each cache query. Can be used to cancel a cache query
62
+ */
63
+ @interface SDImageCacheToken : NSObject <SDWebImageOperation>
64
+
65
+ /**
66
+ Cancel the current cache query.
67
+ */
68
+ - (void)cancel;
69
+
70
+ /**
71
+ The query's cache key.
72
+ */
73
+ @property (nonatomic, strong, nullable, readonly) NSString *key;
74
+
75
+ @end
76
+
77
+ /**
78
+ * SDImageCache maintains a memory cache and a disk cache. Disk cache write operations are performed
79
+ * asynchronous so it doesn’t add unnecessary latency to the UI.
80
+ */
81
+ @interface SDImageCache : NSObject
82
+
83
+ #pragma mark - Properties
84
+
85
+ /**
86
+ * Cache Config object - storing all kind of settings.
87
+ * The property is copy so change of current config will not accidentally affect other cache's config.
88
+ */
89
+ @property (nonatomic, copy, nonnull, readonly) SDImageCacheConfig *config;
90
+
91
+ /**
92
+ * The memory cache implementation object used for current image cache.
93
+ * By default we use `SDMemoryCache` class, you can also use this to call your own implementation class method.
94
+ * @note To customize this class, check `SDImageCacheConfig.memoryCacheClass` property.
95
+ */
96
+ @property (nonatomic, strong, readonly, nonnull) id<SDMemoryCache> memoryCache;
97
+
98
+ /**
99
+ * The disk cache implementation object used for current image cache.
100
+ * By default we use `SDMemoryCache` class, you can also use this to call your own implementation class method.
101
+ * @note To customize this class, check `SDImageCacheConfig.diskCacheClass` property.
102
+ * @warning When calling method about read/write in disk cache, be sure to either make your disk cache implementation IO-safe or using the same access queue to avoid issues.
103
+ */
104
+ @property (nonatomic, strong, readonly, nonnull) id<SDDiskCache> diskCache;
105
+
106
+ /**
107
+ * The disk cache's root path
108
+ */
109
+ @property (nonatomic, copy, nonnull, readonly) NSString *diskCachePath;
110
+
111
+ /**
112
+ * The additional disk cache path to check if the query from disk cache not exist;
113
+ * The `key` param is the image cache key. The returned file path will be used to load the disk cache. If return nil, ignore it.
114
+ * Useful if you want to bundle pre-loaded images with your app
115
+ */
116
+ @property (nonatomic, copy, nullable) SDImageCacheAdditionalCachePathBlock additionalCachePathBlock;
117
+
118
+ #pragma mark - Singleton and initialization
119
+
120
+ /**
121
+ * Returns global shared cache instance
122
+ */
123
+ @property (nonatomic, class, readonly, nonnull) SDImageCache *sharedImageCache;
124
+
125
+ /**
126
+ * Control the default disk cache directory. This will effect all the SDImageCache instance created after modification, even for shared image cache.
127
+ * This can be used to share the same disk cache with the App and App Extension (Today/Notification Widget) using `- [NSFileManager.containerURLForSecurityApplicationGroupIdentifier:]`.
128
+ * @note If you pass nil, the value will be reset to `~/Library/Caches/com.hackemist.SDImageCache`.
129
+ * @note We still preserve the `namespace` arg, which means, if you change this property into `/path/to/use`, the `SDImageCache.sharedImageCache.diskCachePath` should be `/path/to/use/default` because shared image cache use `default` as namespace.
130
+ * Defaults to nil.
131
+ */
132
+ @property (nonatomic, class, readwrite, null_resettable) NSString *defaultDiskCacheDirectory;
133
+
134
+ /**
135
+ * Init a new cache store with a specific namespace
136
+ * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/)
137
+ *
138
+ * @param ns The namespace to use for this cache store
139
+ */
140
+ - (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns;
141
+
142
+ /**
143
+ * Init a new cache store with a specific namespace and directory.
144
+ * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/)
145
+ *
146
+ * @param ns The namespace to use for this cache store
147
+ * @param directory Directory to cache disk images in
148
+ */
149
+ - (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns
150
+ diskCacheDirectory:(nullable NSString *)directory;
151
+
152
+ /**
153
+ * Init a new cache store with a specific namespace, directory and config.
154
+ * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/)
155
+ *
156
+ * @param ns The namespace to use for this cache store
157
+ * @param directory Directory to cache disk images in
158
+ * @param config The cache config to be used to create the cache. You can provide custom memory cache or disk cache class in the cache config
159
+ */
160
+ - (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns
161
+ diskCacheDirectory:(nullable NSString *)directory
162
+ config:(nullable SDImageCacheConfig *)config NS_DESIGNATED_INITIALIZER;
163
+
164
+ #pragma mark - Cache paths
165
+
166
+ /**
167
+ Get the cache path for a certain key
168
+
169
+ @param key The unique image cache key
170
+ @return The cache path. You can check `lastPathComponent` to grab the file name.
171
+ */
172
+ - (nullable NSString *)cachePathForKey:(nullable NSString *)key;
173
+
174
+ #pragma mark - Store Ops
175
+
176
+ /**
177
+ * Asynchronously store an image into memory and disk cache at the given key.
178
+ *
179
+ * @param image The image to store
180
+ * @param key The unique image cache key, usually it's image absolute URL
181
+ * @param completionBlock A block executed after the operation is finished
182
+ */
183
+ - (void)storeImage:(nullable UIImage *)image
184
+ forKey:(nullable NSString *)key
185
+ completion:(nullable SDWebImageNoParamsBlock)completionBlock;
186
+
187
+ /**
188
+ * Asynchronously store an image into memory and disk cache at the given key.
189
+ *
190
+ * @param image The image to store
191
+ * @param key The unique image cache key, usually it's image absolute URL
192
+ * @param toDisk Store the image to disk cache if YES. If NO, the completion block is called synchronously
193
+ * @param completionBlock A block executed after the operation is finished
194
+ * @note If no image data is provided and encode to disk, we will try to detect the image format (using either `sd_imageFormat` or `SDAnimatedImage` protocol method) and animation status, to choose the best matched format, including GIF, JPEG or PNG.
195
+ */
196
+ - (void)storeImage:(nullable UIImage *)image
197
+ forKey:(nullable NSString *)key
198
+ toDisk:(BOOL)toDisk
199
+ completion:(nullable SDWebImageNoParamsBlock)completionBlock;
200
+
201
+ /**
202
+ * Asynchronously store an image data into disk cache at the given key.
203
+ *
204
+ * @param imageData The image data to store
205
+ * @param key The unique image cache key, usually it's image absolute URL
206
+ * @param completionBlock A block executed after the operation is finished
207
+ */
208
+ - (void)storeImageData:(nullable NSData *)imageData
209
+ forKey:(nullable NSString *)key
210
+ completion:(nullable SDWebImageNoParamsBlock)completionBlock;
211
+
212
+ /**
213
+ * Asynchronously store an image into memory and disk cache at the given key.
214
+ *
215
+ * @param image The image to store
216
+ * @param imageData The image data as returned by the server, this representation will be used for disk storage
217
+ * instead of converting the given image object into a storable/compressed image format in order
218
+ * to save quality and CPU
219
+ * @param key The unique image cache key, usually it's image absolute URL
220
+ * @param toDisk Store the image to disk cache if YES. If NO, the completion block is called synchronously
221
+ * @param completionBlock A block executed after the operation is finished
222
+ * @note If no image data is provided and encode to disk, we will try to detect the image format (using either `sd_imageFormat` or `SDAnimatedImage` protocol method) and animation status, to choose the best matched format, including GIF, JPEG or PNG.
223
+ */
224
+ - (void)storeImage:(nullable UIImage *)image
225
+ imageData:(nullable NSData *)imageData
226
+ forKey:(nullable NSString *)key
227
+ toDisk:(BOOL)toDisk
228
+ completion:(nullable SDWebImageNoParamsBlock)completionBlock;
229
+
230
+ /**
231
+ * Asynchronously store an image into memory and disk cache at the given key.
232
+ *
233
+ * @param image The image to store
234
+ * @param imageData The image data as returned by the server, this representation will be used for disk storage
235
+ * instead of converting the given image object into a storable/compressed image format in order
236
+ * to save quality and CPU
237
+ * @param key The unique image cache key, usually it's image absolute URL
238
+ * @param options A mask to specify options to use for this store
239
+ * @param context The context options to use. Pass `.callbackQueue` to control callback queue
240
+ * @param cacheType The image store op cache type
241
+ * @param completionBlock A block executed after the operation is finished
242
+ * @note If no image data is provided and encode to disk, we will try to detect the image format (using either `sd_imageFormat` or `SDAnimatedImage` protocol method) and animation status, to choose the best matched format, including GIF, JPEG or PNG.
243
+ */
244
+ - (void)storeImage:(nullable UIImage *)image
245
+ imageData:(nullable NSData *)imageData
246
+ forKey:(nullable NSString *)key
247
+ options:(SDWebImageOptions)options
248
+ context:(nullable SDWebImageContext *)context
249
+ cacheType:(SDImageCacheType)cacheType
250
+ completion:(nullable SDWebImageNoParamsBlock)completionBlock;
251
+
252
+ /**
253
+ * Synchronously store an image into memory cache at the given key.
254
+ *
255
+ * @param image The image to store
256
+ * @param key The unique image cache key, usually it's image absolute URL
257
+ */
258
+ - (void)storeImageToMemory:(nullable UIImage*)image
259
+ forKey:(nullable NSString *)key;
260
+
261
+ /**
262
+ * Synchronously store an image data into disk cache at the given key.
263
+ *
264
+ * @param imageData The image data to store
265
+ * @param key The unique image cache key, usually it's image absolute URL
266
+ * @note In history, when disk cache hit, the image will write back into memory cache, which is mostly unwanted behavior. From new version this behavior is removed.
267
+ */
268
+ - (void)storeImageDataToDisk:(nullable NSData *)imageData
269
+ forKey:(nullable NSString *)key;
270
+
271
+
272
+ #pragma mark - Contains and Check Ops
273
+
274
+ /**
275
+ * Asynchronously check if image exists in disk cache already (does not load the image)
276
+ *
277
+ * @param key the key describing the url
278
+ * @param completionBlock the block to be executed when the check is done.
279
+ * @note the completion block will be always executed on the main queue
280
+ */
281
+ - (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDImageCacheCheckCompletionBlock)completionBlock;
282
+
283
+ /**
284
+ * Synchronously check if image data exists in disk cache already (does not load the image)
285
+ *
286
+ * @param key the key describing the url
287
+ */
288
+ - (BOOL)diskImageDataExistsWithKey:(nullable NSString *)key;
289
+
290
+ #pragma mark - Query and Retrieve Ops
291
+
292
+ /**
293
+ * Synchronously query the image data for the given key in disk cache. You can decode the image data to image after loaded.
294
+ *
295
+ * @param key The unique key used to store the wanted image
296
+ * @return The image data for the given key, or nil if not found.
297
+ */
298
+ - (nullable NSData *)diskImageDataForKey:(nullable NSString *)key;
299
+
300
+ /**
301
+ * Asynchronously query the image data for the given key in disk cache. You can decode the image data to image after loaded.
302
+ *
303
+ * @param key The unique key used to store the wanted image
304
+ * @param completionBlock the block to be executed when the query is done.
305
+ * @note the completion block will be always executed on the main queue
306
+ */
307
+ - (void)diskImageDataQueryForKey:(nullable NSString *)key completion:(nullable SDImageCacheQueryDataCompletionBlock)completionBlock;
308
+
309
+ /**
310
+ * Asynchronously queries the cache with operation and call the completion when done.
311
+ *
312
+ * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`.
313
+ * @param doneBlock The completion block. Will not get called if the operation is cancelled
314
+ *
315
+ * @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancelled
316
+ * @note In history, when disk cache hit, the image will write back into memory cache, which is mostly unwanted behavior. From new version this behavior is removed.
317
+ */
318
+ - (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;
319
+
320
+ /**
321
+ * Asynchronously queries the cache with operation and call the completion when done.
322
+ *
323
+ * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`.
324
+ * @param options A mask to specify options to use for this cache query
325
+ * @param doneBlock The completion block. Will not get called if the operation is cancelled
326
+ *
327
+ * @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancelled
328
+ * @warning If you query with thumbnail cache key, you'd better not pass the thumbnail pixel size context, which is undefined behavior.
329
+ * @note In history, when disk cache hit, the image will write back into memory cache, which is mostly unwanted behavior. From new version this behavior is removed.
330
+ */
331
+ - (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;
332
+
333
+ /**
334
+ * Asynchronously queries the cache with operation and call the completion when done.
335
+ *
336
+ * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`.
337
+ * @param options A mask to specify options to use for this cache query
338
+ * @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.
339
+ * @param doneBlock The completion block. Will not get called if the operation is cancelled
340
+ *
341
+ * @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancellederation, will callback immediately when cancelled
342
+ * @warning If you query with thumbnail cache key, you'd better not pass the thumbnail pixel size context, which is undefined behavior.
343
+ * @note In history, when disk cache hit, the image will write back into memory cache, which is mostly unwanted behavior. From new version this behavior is removed.
344
+ */
345
+ - (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;
346
+
347
+ /**
348
+ * Asynchronously queries the cache with operation and call the completion when done.
349
+ *
350
+ * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`.
351
+ * @param options A mask to specify options to use for this cache query
352
+ * @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.
353
+ * @param queryCacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediately.
354
+ * @param doneBlock The completion block. Will not get called if the operation is cancelled
355
+ *
356
+ * @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancelled
357
+ * @warning If you query with thumbnail cache key, you'd better not pass the thumbnail pixel size context, which is undefined behavior.
358
+ * @note In history, when disk cache hit, the image will write back into memory cache, which is mostly unwanted behavior. From new version this behavior is removed.
359
+ */
360
+ - (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;
361
+
362
+ /**
363
+ * Synchronously query the memory cache.
364
+ *
365
+ * @param key The unique key used to store the image
366
+ * @return The image for the given key, or nil if not found.
367
+ */
368
+ - (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key;
369
+
370
+ /**
371
+ * Synchronously query the disk cache.
372
+ *
373
+ * @param key The unique key used to store the image
374
+ * @return The image for the given key, or nil if not found.
375
+ */
376
+ - (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key;
377
+
378
+ /**
379
+ * Synchronously query the disk cache. With the options and context which may effect the image generation. (Such as transformer, animated image, thumbnail, etc)
380
+ *
381
+ * @param key The unique key used to store the image
382
+ * @param options A mask to specify options to use for this cache query
383
+ * @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.
384
+ * @return The image for the given key, or nil if not found.
385
+ */
386
+ - (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context;
387
+
388
+ /**
389
+ * Synchronously query the cache (memory and or disk) after checking the memory cache.
390
+ *
391
+ * @param key The unique key used to store the image
392
+ * @return The image for the given key, or nil if not found.
393
+ */
394
+ - (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key;
395
+
396
+ /**
397
+ * Synchronously query the cache (memory and or disk) after checking the memory cache. With the options and context which may effect the image generation. (Such as transformer, animated image, thumbnail, etc)
398
+ *
399
+ * @param key The unique key used to store the image
400
+ * @param options A mask to specify options to use for this cache query
401
+ * @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.
402
+ * @return The image for the given key, or nil if not found.
403
+ */
404
+ - (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context;
405
+
406
+ #pragma mark - Remove Ops
407
+
408
+ /**
409
+ * Asynchronously remove the image from memory and disk cache
410
+ *
411
+ * @param key The unique image cache key
412
+ * @param completion A block that should be executed after the image has been removed (optional)
413
+ */
414
+ - (void)removeImageForKey:(nullable NSString *)key withCompletion:(nullable SDWebImageNoParamsBlock)completion;
415
+
416
+ /**
417
+ * Asynchronously remove the image from memory and optionally disk cache
418
+ *
419
+ * @param key The unique image cache key
420
+ * @param fromDisk Also remove cache entry from disk if YES. If NO, the completion block is called synchronously
421
+ * @param completion A block that should be executed after the image has been removed (optional)
422
+ */
423
+ - (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion;
424
+
425
+ /**
426
+ Synchronously remove the image from memory cache.
427
+
428
+ @param key The unique image cache key
429
+ */
430
+ - (void)removeImageFromMemoryForKey:(nullable NSString *)key;
431
+
432
+ /**
433
+ Synchronously remove the image from disk cache.
434
+
435
+ @param key The unique image cache key
436
+ */
437
+ - (void)removeImageFromDiskForKey:(nullable NSString *)key;
438
+
439
+ #pragma mark - Cache clean Ops
440
+
441
+ /**
442
+ * Synchronously Clear all memory cached images
443
+ */
444
+ - (void)clearMemory;
445
+
446
+ /**
447
+ * Asynchronously clear all disk cached images. Non-blocking method - returns immediately.
448
+ * @param completion A block that should be executed after cache expiration completes (optional)
449
+ */
450
+ - (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion;
451
+
452
+ /**
453
+ * Asynchronously remove all expired cached image from disk. Non-blocking method - returns immediately.
454
+ * @param completionBlock A block that should be executed after cache expiration completes (optional)
455
+ */
456
+ - (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock;
457
+
458
+ #pragma mark - Cache Info
459
+
460
+ /**
461
+ * Get the total bytes size of images in the disk cache
462
+ */
463
+ - (NSUInteger)totalDiskSize;
464
+
465
+ /**
466
+ * Get the number of images in the disk cache
467
+ */
468
+ - (NSUInteger)totalDiskCount;
469
+
470
+ /**
471
+ * Asynchronously calculate the disk cache's size.
472
+ */
473
+ - (void)calculateSizeWithCompletionBlock:(nullable SDImageCacheCalculateSizeBlock)completionBlock;
474
+
475
+ @end
476
+
477
+ /**
478
+ * SDImageCache is the built-in image cache implementation for web image manager. It adopts `SDImageCache` protocol to provide the function for web image manager to use for image loading process.
479
+ */
480
+ @interface SDImageCache (SDImageCache) <SDImageCache>
481
+
482
+ @end