@momo-kits/native-kits 0.0.1-beta.5 → 0.89.1-2
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.
- package/README.md +1 -0
- package/android/.gradle/8.0/checksums/checksums.lock +0 -0
- package/android/.gradle/8.0/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/8.0/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.0/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.0/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.0/gc.properties +0 -0
- package/android/.gradle/config.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +12 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/.idea/workspace.xml +50 -0
- package/android/build.gradle +35 -69
- package/android/local.properties +8 -0
- package/android/proguard-rules.pro +21 -0
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/com/momoplatform/nativekits/foundations/Button.kt +16 -0
- package/android/src/main/java/com/momoplatform/nativekits/libs/Logo.kt +63 -0
- package/android/src/main/java/com/momoplatform/nativekits/libs/TrustBanner.kt +246 -0
- package/android/src/main/res/drawable/ic_launcher_background.xml +170 -0
- package/android/src/main/res/drawable-v24/ic_launcher_foreground.xml +30 -0
- package/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
- package/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +6 -0
- package/android/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/values/colors.xml +10 -0
- package/android/src/main/res/values/strings.xml +3 -0
- package/android/src/main/res/values/themes.xml +3 -0
- package/android/src/main/res/values-night/themes.xml +3 -0
- package/android/src/main/res/xml/backup_rules.xml +13 -0
- package/android/src/main/res/xml/data_extraction_rules.xml +19 -0
- package/build.gradle.kts +18 -0
- package/compose/build.gradle.kts +82 -0
- package/compose/src/androidMain/AndroidManifest.xml +2 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/utils/Platform.kt +3 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +8 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/utils/Utils.android.kt +14 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Components.kt +194 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +197 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +62 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +27 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +288 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +80 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +42 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +126 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +299 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +246 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +223 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +244 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +281 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PromotionPopup.kt +72 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +65 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +64 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +63 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +73 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +42 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +150 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +13 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +173 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +242 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1321 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Platform.kt +3 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +5 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +97 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/utils/Platform.kt +3 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +9 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/utils/Utils.ios.kt +18 -0
- package/gradle.properties +19 -0
- package/gradlew +240 -0
- package/gradlew.bat +91 -0
- package/ios/Button/Button.swift +9 -2
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
- package/ios/Colors+Radius+Spacing/Colors.swift +21 -19
- package/ios/Input/Input.swift +1 -0
- package/ios/OTPKeyboard/KeyboardButton.swift +12 -4
- package/ios/Popup/PopupDisplay.swift +72 -81
- package/ios/Popup/PopupInput.swift +96 -0
- package/ios/Popup/PopupPromotion.swift +52 -0
- package/ios/ScrollIndicator/ScrollIndicator.swift +79 -0
- package/ios/Template/Logo/Logo.swift +75 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +189 -0
- package/ios/native-kits.podspec +1 -1
- package/local.properties +8 -0
- package/package.json +6 -6
- package/publish.sh +1 -10
- package/settings.gradle.kts +41 -0
- package/android/gradle.properties +0 -5
- package/android/src/main/java/com/momoplatform/nativekits/NativeKitsPackage.kt +0 -17
- package/android/src/main/java/com/momoplatform/nativekits/NativeKitsViewManager.kt +0 -20
- package/example/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -63
- package/example/ios/Example/Assets.xcassets/Background.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Border.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Card.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Contents.json +0 -6
- package/example/ios/Example/Assets.xcassets/Error.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Primary.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/PrimaryDark.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/PrimaryLight.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Secondary.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Success.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Text.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/TextSecondary.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Warning.colorset/Contents.json +0 -38
- package/example/ios/Example/ComponentDetail.swift +0 -35
- package/example/ios/Example/ComponentItem.swift +0 -24
- package/example/ios/Example/ComponentModel.swift +0 -38
- package/example/ios/Example/ContentView.swift +0 -39
- package/example/ios/Example/Example.entitlements +0 -10
- package/example/ios/Example/Foundation/ButtonDemo.swift +0 -80
- package/example/ios/Example/Foundation/ImageDemo.swift +0 -43
- package/example/ios/Example/Foundation/Popup/ActionSheets.swift +0 -136
- package/example/ios/Example/Foundation/Popup/Floats.swift +0 -127
- package/example/ios/Example/Foundation/Popup/Popups.swift +0 -51
- package/example/ios/Example/Foundation/PopupDemo.swift +0 -389
- package/example/ios/Example/Foundation/TextInputDemo.swift +0 -36
- package/example/ios/Example/Foundation/TypographyDemo.swift +0 -53
- package/example/ios/Example/Foundation.swift +0 -26
- package/example/ios/Example/Info.plist +0 -18
- package/example/ios/Example/Library/CheckboxDemo.swift +0 -19
- package/example/ios/Example/Library/SwipeableDemo.swift +0 -105
- package/example/ios/Example/Library/SwitchDemo.swift +0 -19
- package/example/ios/Example/Library.swift +0 -26
- package/example/ios/Example/Main.swift +0 -27
- package/example/ios/Example/Overview.swift +0 -20
- package/example/ios/Example/Preview Content/Preview Assets.xcassets/Contents.json +0 -6
- package/example/ios/Example/Resource/SFProText-Black.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Bold.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Heavy.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Light.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Medium.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Regular.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Semibold.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Thin.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Ultralight.ttf +0 -0
- package/example/ios/Example/Resource/foundation.json +0 -33
- package/example/ios/Example/Resource/library.json +0 -18
- package/example/ios/Example/Utils.swift +0 -30
- package/example/ios/Example/ViewModifier/DarkViewModifier.swift +0 -22
- package/example/ios/Example.xcodeproj/project.pbxproj +0 -581
- package/example/ios/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/example/ios/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/Example.xcodeproj/project.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/example/ios/Example.xcworkspace/contents.xcworkspacedata +0 -10
- package/example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
- package/example/ios/Podfile +0 -7
- package/example/ios/Podfile.lock +0 -35
- package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +0 -37
- package/example/ios/Pods/Manifest.lock +0 -35
- package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -2047
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -46
- package/example/ios/Pods/SDWebImage/LICENSE +0 -20
- package/example/ios/Pods/SDWebImage/README.md +0 -352
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h +0 -340
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m +0 -172
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h +0 -63
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m +0 -165
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h +0 -67
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m +0 -120
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h +0 -114
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m +0 -392
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h +0 -112
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m +0 -420
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h +0 -23
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m +0 -133
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h +0 -168
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m +0 -79
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h +0 -110
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m +0 -540
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h +0 -145
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m +0 -326
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h +0 -73
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m +0 -256
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h +0 -19
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m +0 -58
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h +0 -23
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m +0 -98
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h +0 -450
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m +0 -1030
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h +0 -153
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m +0 -68
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h +0 -156
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m +0 -138
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h +0 -81
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m +0 -556
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h +0 -297
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m +0 -26
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h +0 -153
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m +0 -822
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h +0 -58
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m +0 -130
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h +0 -36
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m +0 -28
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h +0 -22
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m +0 -58
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h +0 -28
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m +0 -127
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h +0 -25
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m +0 -101
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h +0 -58
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m +0 -807
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h +0 -30
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m +0 -420
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h +0 -146
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m +0 -170
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h +0 -40
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m +0 -123
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h +0 -241
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m +0 -331
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h +0 -78
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m +0 -158
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h +0 -32
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m +0 -39
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h +0 -36
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m +0 -39
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h +0 -95
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m +0 -17
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h +0 -352
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m +0 -149
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h +0 -314
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m +0 -658
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h +0 -113
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m +0 -60
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h +0 -49
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m +0 -55
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h +0 -191
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m +0 -722
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h +0 -69
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m +0 -71
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h +0 -69
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m +0 -73
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h +0 -32
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m +0 -16
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h +0 -115
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m +0 -275
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h +0 -290
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m +0 -775
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h +0 -27
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m +0 -14
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h +0 -72
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m +0 -59
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h +0 -143
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m +0 -303
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h +0 -131
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m +0 -194
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h +0 -387
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m +0 -234
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h +0 -24
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m +0 -23
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h +0 -46
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m +0 -60
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h +0 -26
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m +0 -22
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h +0 -27
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m +0 -47
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h +0 -89
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m +0 -221
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h +0 -80
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m +0 -47
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h +0 -146
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m +0 -824
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h +0 -129
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m +0 -76
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h +0 -194
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m +0 -67
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h +0 -110
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m +0 -446
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h +0 -48
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m +0 -82
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h +0 -24
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m +0 -42
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h +0 -14
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m +0 -29
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h +0 -21
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m +0 -92
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h +0 -18
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m +0 -32
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h +0 -29
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m +0 -227
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h +0 -19
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m +0 -127
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h +0 -23
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m +0 -164
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h +0 -21
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m +0 -83
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h +0 -39
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h +0 -122
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m +0 -13
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h +0 -20
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m +0 -79
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h +0 -19
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h +0 -667
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h +0 -18
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m +0 -42
- package/example/ios/Pods/SDWebImage/WebImage/SDWebImage.h +0 -89
- package/example/ios/Pods/SDWebImageSwiftUI/LICENSE +0 -19
- package/example/ios/Pods/SDWebImageSwiftUI/README.md +0 -690
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/AnimatedImage.swift +0 -870
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/Backport.swift +0 -59
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/OnChange.swift +0 -52
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/Overlay.swift +0 -124
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/StateObject.swift +0 -151
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Image.swift +0 -78
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageManager.swift +0 -132
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImagePlayer.swift +0 -122
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageViewWrapper.swift +0 -133
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ActivityIndicator.swift +0 -82
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/Indicator.swift +0 -97
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ProgressIndicator.swift +0 -114
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SDWebImageSwiftUI.swift +0 -64
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SwiftUICompatibility.swift +0 -92
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Transition/Transition.swift +0 -93
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/WebImage.swift +0 -509
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Module/SDWebImageSwiftUI.h +0 -15
- package/example/ios/Pods/SkeletonUI/LICENSE +0 -21
- package/example/ios/Pods/SkeletonUI/README.md +0 -137
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Angle/AngleInteractor.swift +0 -29
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Angle/AnglePresenter.swift +0 -7
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Animation/AnimationInteractor.swift +0 -56
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Appearance/AppearanceInteractor.swift +0 -58
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Appearance/AppearancePresenter.swift +0 -5
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/ClosedRange+Normalize.swift +0 -16
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Image+OptionalType.swift +0 -102
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/ModifiedContent+SkeletonModifier.swift +0 -26
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Optional+OptionalType.swift +0 -5
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/SecureField+OptionalType.swift +0 -19
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Text+OptionalType.swift +0 -27
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/TextField+OptionalType.swift +0 -35
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Toggle+OptionalType.swift +0 -29
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/UnitPoint+Angle.swift +0 -8
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/View+SkeletonModifier.swift +0 -8
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Modifiers/SkeletonModifier.swift +0 -52
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Multiline/MultilineInteractor.swift +0 -41
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Multiline/MultilinePresenter.swift +0 -9
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Opacity/OpacityInteractor.swift +0 -29
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Opacity/OpacityPresenter.swift +0 -7
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Position/PositionInteractor.swift +0 -29
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Position/PositionPresenter.swift +0 -7
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Protocols/OptionalType.swift +0 -4
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Radius/RadiusInteractor.swift +0 -29
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Radius/RadiusPresenter.swift +0 -7
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Shape/ShapeInteractor.swift +0 -33
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Shape/ShapePresenter.swift +0 -5
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonForEach.swift +0 -20
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonInteractor.swift +0 -27
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonList.swift +0 -20
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonPresenter.swift +0 -15
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonShape.swift +0 -64
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonView.swift +0 -25
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-prefix.pch +0 -12
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-umbrella.h +0 -16
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +0 -15
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +0 -15
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +0 -75
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +0 -119
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h +0 -16
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +0 -15
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +0 -15
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch +0 -12
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h +0 -75
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig +0 -14
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig +0 -14
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-prefix.pch +0 -12
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-umbrella.h +0 -17
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.debug.xcconfig +0 -17
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.release.xcconfig +0 -17
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-prefix.pch +0 -12
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-umbrella.h +0 -16
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.debug.xcconfig +0 -12
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.release.xcconfig +0 -12
- package/ios/Extensions/View++.swift +0 -9
|
@@ -1,326 +0,0 @@
|
|
|
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 "SDDiskCache.h"
|
|
10
|
-
#import "SDImageCacheConfig.h"
|
|
11
|
-
#import "SDFileAttributeHelper.h"
|
|
12
|
-
#import <CommonCrypto/CommonDigest.h>
|
|
13
|
-
|
|
14
|
-
static NSString * const SDDiskCacheExtendedAttributeName = @"com.hackemist.SDDiskCache";
|
|
15
|
-
|
|
16
|
-
@interface SDDiskCache ()
|
|
17
|
-
|
|
18
|
-
@property (nonatomic, copy) NSString *diskCachePath;
|
|
19
|
-
@property (nonatomic, strong, nonnull) NSFileManager *fileManager;
|
|
20
|
-
|
|
21
|
-
@end
|
|
22
|
-
|
|
23
|
-
@implementation SDDiskCache
|
|
24
|
-
|
|
25
|
-
- (instancetype)init {
|
|
26
|
-
NSAssert(NO, @"Use `initWithCachePath:` with the disk cache path");
|
|
27
|
-
return nil;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
#pragma mark - SDcachePathForKeyDiskCache Protocol
|
|
31
|
-
- (instancetype)initWithCachePath:(NSString *)cachePath config:(nonnull SDImageCacheConfig *)config {
|
|
32
|
-
if (self = [super init]) {
|
|
33
|
-
_diskCachePath = cachePath;
|
|
34
|
-
_config = config;
|
|
35
|
-
[self commonInit];
|
|
36
|
-
}
|
|
37
|
-
return self;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
- (void)commonInit {
|
|
41
|
-
if (self.config.fileManager) {
|
|
42
|
-
self.fileManager = self.config.fileManager;
|
|
43
|
-
} else {
|
|
44
|
-
self.fileManager = [NSFileManager new];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
- (BOOL)containsDataForKey:(NSString *)key {
|
|
49
|
-
NSParameterAssert(key);
|
|
50
|
-
NSString *filePath = [self cachePathForKey:key];
|
|
51
|
-
BOOL exists = [self.fileManager fileExistsAtPath:filePath];
|
|
52
|
-
|
|
53
|
-
// fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name
|
|
54
|
-
// checking the key with and without the extension
|
|
55
|
-
if (!exists) {
|
|
56
|
-
exists = [self.fileManager fileExistsAtPath:filePath.stringByDeletingPathExtension];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return exists;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
- (NSData *)dataForKey:(NSString *)key {
|
|
63
|
-
NSParameterAssert(key);
|
|
64
|
-
NSString *filePath = [self cachePathForKey:key];
|
|
65
|
-
NSData *data = [NSData dataWithContentsOfFile:filePath options:self.config.diskCacheReadingOptions error:nil];
|
|
66
|
-
if (data) {
|
|
67
|
-
return data;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name
|
|
71
|
-
// checking the key with and without the extension
|
|
72
|
-
data = [NSData dataWithContentsOfFile:filePath.stringByDeletingPathExtension options:self.config.diskCacheReadingOptions error:nil];
|
|
73
|
-
if (data) {
|
|
74
|
-
return data;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return nil;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
- (void)setData:(NSData *)data forKey:(NSString *)key {
|
|
81
|
-
NSParameterAssert(data);
|
|
82
|
-
NSParameterAssert(key);
|
|
83
|
-
if (![self.fileManager fileExistsAtPath:self.diskCachePath]) {
|
|
84
|
-
[self.fileManager createDirectoryAtPath:self.diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// get cache Path for image key
|
|
88
|
-
NSString *cachePathForKey = [self cachePathForKey:key];
|
|
89
|
-
// transform to NSURL
|
|
90
|
-
NSURL *fileURL = [NSURL fileURLWithPath:cachePathForKey isDirectory:NO];
|
|
91
|
-
|
|
92
|
-
[data writeToURL:fileURL options:self.config.diskCacheWritingOptions error:nil];
|
|
93
|
-
|
|
94
|
-
// disable iCloud backup
|
|
95
|
-
if (self.config.shouldDisableiCloud) {
|
|
96
|
-
// ignore iCloud backup resource value error
|
|
97
|
-
[fileURL setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
- (NSData *)extendedDataForKey:(NSString *)key {
|
|
102
|
-
NSParameterAssert(key);
|
|
103
|
-
|
|
104
|
-
// get cache Path for image key
|
|
105
|
-
NSString *cachePathForKey = [self cachePathForKey:key];
|
|
106
|
-
|
|
107
|
-
NSData *extendedData = [SDFileAttributeHelper extendedAttribute:SDDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil];
|
|
108
|
-
|
|
109
|
-
return extendedData;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
- (void)setExtendedData:(NSData *)extendedData forKey:(NSString *)key {
|
|
113
|
-
NSParameterAssert(key);
|
|
114
|
-
// get cache Path for image key
|
|
115
|
-
NSString *cachePathForKey = [self cachePathForKey:key];
|
|
116
|
-
|
|
117
|
-
if (!extendedData) {
|
|
118
|
-
// Remove
|
|
119
|
-
[SDFileAttributeHelper removeExtendedAttribute:SDDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil];
|
|
120
|
-
} else {
|
|
121
|
-
// Override
|
|
122
|
-
[SDFileAttributeHelper setExtendedAttribute:SDDiskCacheExtendedAttributeName value:extendedData atPath:cachePathForKey traverseLink:NO overwrite:YES error:nil];
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
- (void)removeDataForKey:(NSString *)key {
|
|
127
|
-
NSParameterAssert(key);
|
|
128
|
-
NSString *filePath = [self cachePathForKey:key];
|
|
129
|
-
[self.fileManager removeItemAtPath:filePath error:nil];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
- (void)removeAllData {
|
|
133
|
-
[self.fileManager removeItemAtPath:self.diskCachePath error:nil];
|
|
134
|
-
[self.fileManager createDirectoryAtPath:self.diskCachePath
|
|
135
|
-
withIntermediateDirectories:YES
|
|
136
|
-
attributes:nil
|
|
137
|
-
error:NULL];
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
- (void)removeExpiredData {
|
|
141
|
-
NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES];
|
|
142
|
-
|
|
143
|
-
// Compute content date key to be used for tests
|
|
144
|
-
NSURLResourceKey cacheContentDateKey = NSURLContentModificationDateKey;
|
|
145
|
-
switch (self.config.diskCacheExpireType) {
|
|
146
|
-
case SDImageCacheConfigExpireTypeAccessDate:
|
|
147
|
-
cacheContentDateKey = NSURLContentAccessDateKey;
|
|
148
|
-
break;
|
|
149
|
-
case SDImageCacheConfigExpireTypeModificationDate:
|
|
150
|
-
cacheContentDateKey = NSURLContentModificationDateKey;
|
|
151
|
-
break;
|
|
152
|
-
case SDImageCacheConfigExpireTypeCreationDate:
|
|
153
|
-
cacheContentDateKey = NSURLCreationDateKey;
|
|
154
|
-
break;
|
|
155
|
-
case SDImageCacheConfigExpireTypeChangeDate:
|
|
156
|
-
cacheContentDateKey = NSURLAttributeModificationDateKey;
|
|
157
|
-
break;
|
|
158
|
-
default:
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
NSArray<NSString *> *resourceKeys = @[NSURLIsDirectoryKey, cacheContentDateKey, NSURLTotalFileAllocatedSizeKey];
|
|
163
|
-
|
|
164
|
-
// This enumerator prefetches useful properties for our cache files.
|
|
165
|
-
NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtURL:diskCacheURL
|
|
166
|
-
includingPropertiesForKeys:resourceKeys
|
|
167
|
-
options:NSDirectoryEnumerationSkipsHiddenFiles
|
|
168
|
-
errorHandler:NULL];
|
|
169
|
-
|
|
170
|
-
NSDate *expirationDate = (self.config.maxDiskAge < 0) ? nil: [NSDate dateWithTimeIntervalSinceNow:-self.config.maxDiskAge];
|
|
171
|
-
NSMutableDictionary<NSURL *, NSDictionary<NSString *, id> *> *cacheFiles = [NSMutableDictionary dictionary];
|
|
172
|
-
NSUInteger currentCacheSize = 0;
|
|
173
|
-
|
|
174
|
-
// Enumerate all of the files in the cache directory. This loop has two purposes:
|
|
175
|
-
//
|
|
176
|
-
// 1. Removing files that are older than the expiration date.
|
|
177
|
-
// 2. Storing file attributes for the size-based cleanup pass.
|
|
178
|
-
NSMutableArray<NSURL *> *urlsToDelete = [[NSMutableArray alloc] init];
|
|
179
|
-
for (NSURL *fileURL in fileEnumerator) {
|
|
180
|
-
NSError *error;
|
|
181
|
-
NSDictionary<NSString *, id> *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:&error];
|
|
182
|
-
|
|
183
|
-
// Skip directories and errors.
|
|
184
|
-
if (error || !resourceValues || [resourceValues[NSURLIsDirectoryKey] boolValue]) {
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Remove files that are older than the expiration date;
|
|
189
|
-
NSDate *modifiedDate = resourceValues[cacheContentDateKey];
|
|
190
|
-
if (expirationDate && [[modifiedDate laterDate:expirationDate] isEqualToDate:expirationDate]) {
|
|
191
|
-
[urlsToDelete addObject:fileURL];
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// Store a reference to this file and account for its total size.
|
|
196
|
-
NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey];
|
|
197
|
-
currentCacheSize += totalAllocatedSize.unsignedIntegerValue;
|
|
198
|
-
cacheFiles[fileURL] = resourceValues;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
for (NSURL *fileURL in urlsToDelete) {
|
|
202
|
-
[self.fileManager removeItemAtURL:fileURL error:nil];
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// If our remaining disk cache exceeds a configured maximum size, perform a second
|
|
206
|
-
// size-based cleanup pass. We delete the oldest files first.
|
|
207
|
-
NSUInteger maxDiskSize = self.config.maxDiskSize;
|
|
208
|
-
if (maxDiskSize > 0 && currentCacheSize > maxDiskSize) {
|
|
209
|
-
// Target half of our maximum cache size for this cleanup pass.
|
|
210
|
-
const NSUInteger desiredCacheSize = maxDiskSize / 2;
|
|
211
|
-
|
|
212
|
-
// Sort the remaining cache files by their last modification time or last access time (oldest first).
|
|
213
|
-
NSArray<NSURL *> *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent
|
|
214
|
-
usingComparator:^NSComparisonResult(id obj1, id obj2) {
|
|
215
|
-
return [obj1[cacheContentDateKey] compare:obj2[cacheContentDateKey]];
|
|
216
|
-
}];
|
|
217
|
-
|
|
218
|
-
// Delete files until we fall below our desired cache size.
|
|
219
|
-
for (NSURL *fileURL in sortedFiles) {
|
|
220
|
-
if ([self.fileManager removeItemAtURL:fileURL error:nil]) {
|
|
221
|
-
NSDictionary<NSString *, id> *resourceValues = cacheFiles[fileURL];
|
|
222
|
-
NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey];
|
|
223
|
-
currentCacheSize -= totalAllocatedSize.unsignedIntegerValue;
|
|
224
|
-
|
|
225
|
-
if (currentCacheSize < desiredCacheSize) {
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
- (nullable NSString *)cachePathForKey:(NSString *)key {
|
|
234
|
-
NSParameterAssert(key);
|
|
235
|
-
return [self cachePathForKey:key inPath:self.diskCachePath];
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
- (NSUInteger)totalSize {
|
|
239
|
-
NSUInteger size = 0;
|
|
240
|
-
NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtPath:self.diskCachePath];
|
|
241
|
-
for (NSString *fileName in fileEnumerator) {
|
|
242
|
-
NSString *filePath = [self.diskCachePath stringByAppendingPathComponent:fileName];
|
|
243
|
-
NSDictionary<NSString *, id> *attrs = [self.fileManager attributesOfItemAtPath:filePath error:nil];
|
|
244
|
-
size += [attrs fileSize];
|
|
245
|
-
}
|
|
246
|
-
return size;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
- (NSUInteger)totalCount {
|
|
250
|
-
NSUInteger count = 0;
|
|
251
|
-
NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtPath:self.diskCachePath];
|
|
252
|
-
count = fileEnumerator.allObjects.count;
|
|
253
|
-
return count;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
#pragma mark - Cache paths
|
|
257
|
-
|
|
258
|
-
- (nullable NSString *)cachePathForKey:(nullable NSString *)key inPath:(nonnull NSString *)path {
|
|
259
|
-
NSString *filename = SDDiskCacheFileNameForKey(key);
|
|
260
|
-
return [path stringByAppendingPathComponent:filename];
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
- (void)moveCacheDirectoryFromPath:(nonnull NSString *)srcPath toPath:(nonnull NSString *)dstPath {
|
|
264
|
-
NSParameterAssert(srcPath);
|
|
265
|
-
NSParameterAssert(dstPath);
|
|
266
|
-
// Check if old path is equal to new path
|
|
267
|
-
if ([srcPath isEqualToString:dstPath]) {
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
BOOL isDirectory;
|
|
271
|
-
// Check if old path is directory
|
|
272
|
-
if (![self.fileManager fileExistsAtPath:srcPath isDirectory:&isDirectory] || !isDirectory) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
// Check if new path is directory
|
|
276
|
-
if (![self.fileManager fileExistsAtPath:dstPath isDirectory:&isDirectory] || !isDirectory) {
|
|
277
|
-
if (!isDirectory) {
|
|
278
|
-
// New path is not directory, remove file
|
|
279
|
-
[self.fileManager removeItemAtPath:dstPath error:nil];
|
|
280
|
-
}
|
|
281
|
-
NSString *dstParentPath = [dstPath stringByDeletingLastPathComponent];
|
|
282
|
-
// Creates any non-existent parent directories as part of creating the directory in path
|
|
283
|
-
if (![self.fileManager fileExistsAtPath:dstParentPath]) {
|
|
284
|
-
[self.fileManager createDirectoryAtPath:dstParentPath withIntermediateDirectories:YES attributes:nil error:NULL];
|
|
285
|
-
}
|
|
286
|
-
// New directory does not exist, rename directory
|
|
287
|
-
[self.fileManager moveItemAtPath:srcPath toPath:dstPath error:nil];
|
|
288
|
-
} else {
|
|
289
|
-
// New directory exist, merge the files
|
|
290
|
-
NSDirectoryEnumerator *dirEnumerator = [self.fileManager enumeratorAtPath:srcPath];
|
|
291
|
-
NSString *file;
|
|
292
|
-
while ((file = [dirEnumerator nextObject])) {
|
|
293
|
-
[self.fileManager moveItemAtPath:[srcPath stringByAppendingPathComponent:file] toPath:[dstPath stringByAppendingPathComponent:file] error:nil];
|
|
294
|
-
}
|
|
295
|
-
// Remove the old path
|
|
296
|
-
[self.fileManager removeItemAtPath:srcPath error:nil];
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
#pragma mark - Hash
|
|
301
|
-
|
|
302
|
-
#define SD_MAX_FILE_EXTENSION_LENGTH (NAME_MAX - CC_MD5_DIGEST_LENGTH * 2 - 1)
|
|
303
|
-
|
|
304
|
-
#pragma clang diagnostic push
|
|
305
|
-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
306
|
-
static inline NSString * _Nonnull SDDiskCacheFileNameForKey(NSString * _Nullable key) {
|
|
307
|
-
const char *str = key.UTF8String;
|
|
308
|
-
if (str == NULL) {
|
|
309
|
-
str = "";
|
|
310
|
-
}
|
|
311
|
-
unsigned char r[CC_MD5_DIGEST_LENGTH];
|
|
312
|
-
CC_MD5(str, (CC_LONG)strlen(str), r);
|
|
313
|
-
NSURL *keyURL = [NSURL URLWithString:key];
|
|
314
|
-
NSString *ext = keyURL ? keyURL.pathExtension : key.pathExtension;
|
|
315
|
-
// File system has file name length limit, we need to check if ext is too long, we don't add it to the filename
|
|
316
|
-
if (ext.length > SD_MAX_FILE_EXTENSION_LENGTH) {
|
|
317
|
-
ext = nil;
|
|
318
|
-
}
|
|
319
|
-
NSString *filename = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%@",
|
|
320
|
-
r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10],
|
|
321
|
-
r[11], r[12], r[13], r[14], r[15], ext.length == 0 ? @"" : [NSString stringWithFormat:@".%@", ext]];
|
|
322
|
-
return filename;
|
|
323
|
-
}
|
|
324
|
-
#pragma clang diagnostic pop
|
|
325
|
-
|
|
326
|
-
@end
|
|
@@ -1,73 +0,0 @@
|
|
|
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
|
-
typedef void (^SDGraphicsImageDrawingActions)(CGContextRef _Nonnull context);
|
|
21
|
-
typedef NS_ENUM(NSInteger, SDGraphicsImageRendererFormatRange) {
|
|
22
|
-
SDGraphicsImageRendererFormatRangeUnspecified = -1,
|
|
23
|
-
SDGraphicsImageRendererFormatRangeAutomatic = 0,
|
|
24
|
-
SDGraphicsImageRendererFormatRangeExtended,
|
|
25
|
-
SDGraphicsImageRendererFormatRangeStandard
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/// A set of drawing attributes that represent the configuration of an image renderer context.
|
|
29
|
-
@interface SDGraphicsImageRendererFormat : NSObject
|
|
30
|
-
|
|
31
|
-
/// The display scale of the image renderer context.
|
|
32
|
-
/// The default value is equal to the scale of the main screen.
|
|
33
|
-
@property (nonatomic) CGFloat scale;
|
|
34
|
-
|
|
35
|
-
/// A Boolean value indicating whether the underlying Core Graphics context has an alpha channel.
|
|
36
|
-
/// The default value is NO.
|
|
37
|
-
@property (nonatomic) BOOL opaque;
|
|
38
|
-
|
|
39
|
-
/// Specifying whether the bitmap context should use extended color.
|
|
40
|
-
/// For iOS 12+, the value is from system `preferredRange` property
|
|
41
|
-
/// For iOS 10-11, the value is from system `prefersExtendedRange` property
|
|
42
|
-
/// For iOS 9-, the value is `.standard`
|
|
43
|
-
@property (nonatomic) SDGraphicsImageRendererFormatRange preferredRange;
|
|
44
|
-
|
|
45
|
-
/// Init the default format. See each properties's default value.
|
|
46
|
-
- (nonnull instancetype)init;
|
|
47
|
-
|
|
48
|
-
/// Returns a new format best suited for the main screen’s current configuration.
|
|
49
|
-
+ (nonnull instancetype)preferredFormat;
|
|
50
|
-
|
|
51
|
-
@end
|
|
52
|
-
|
|
53
|
-
/// A graphics renderer for creating Core Graphics-backed images.
|
|
54
|
-
@interface SDGraphicsImageRenderer : NSObject
|
|
55
|
-
|
|
56
|
-
/// Creates an image renderer for drawing images of a given size.
|
|
57
|
-
/// @param size The size of images output from the renderer, specified in points.
|
|
58
|
-
/// @return An initialized image renderer.
|
|
59
|
-
- (nonnull instancetype)initWithSize:(CGSize)size;
|
|
60
|
-
|
|
61
|
-
/// Creates a new image renderer with a given size and format.
|
|
62
|
-
/// @param size The size of images output from the renderer, specified in points.
|
|
63
|
-
/// @param format A SDGraphicsImageRendererFormat object that encapsulates the format used to create the renderer context.
|
|
64
|
-
/// @return An initialized image renderer.
|
|
65
|
-
- (nonnull instancetype)initWithSize:(CGSize)size format:(nonnull SDGraphicsImageRendererFormat *)format;
|
|
66
|
-
|
|
67
|
-
/// Creates an image by following a set of drawing instructions.
|
|
68
|
-
/// @param actions A SDGraphicsImageDrawingActions block that, when invoked by the renderer, executes a set of drawing instructions to create the output image.
|
|
69
|
-
/// @note You should not retain or use the context outside the block, it's non-escaping.
|
|
70
|
-
/// @return A UIImage object created by the supplied drawing actions.
|
|
71
|
-
- (nonnull UIImage *)imageWithActions:(nonnull NS_NOESCAPE SDGraphicsImageDrawingActions)actions;
|
|
72
|
-
|
|
73
|
-
@end
|
|
@@ -1,256 +0,0 @@
|
|
|
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 "SDGraphicsImageRenderer.h"
|
|
10
|
-
#import "SDImageGraphics.h"
|
|
11
|
-
|
|
12
|
-
@interface SDGraphicsImageRendererFormat ()
|
|
13
|
-
#if SD_UIKIT
|
|
14
|
-
@property (nonatomic, strong) UIGraphicsImageRendererFormat *uiformat API_AVAILABLE(ios(10.0), tvos(10.0));
|
|
15
|
-
#endif
|
|
16
|
-
@end
|
|
17
|
-
|
|
18
|
-
@implementation SDGraphicsImageRendererFormat
|
|
19
|
-
@synthesize scale = _scale;
|
|
20
|
-
@synthesize opaque = _opaque;
|
|
21
|
-
@synthesize preferredRange = _preferredRange;
|
|
22
|
-
|
|
23
|
-
#pragma mark - Property
|
|
24
|
-
- (CGFloat)scale {
|
|
25
|
-
#if SD_UIKIT
|
|
26
|
-
if (@available(iOS 10.0, tvOS 10.10, *)) {
|
|
27
|
-
return self.uiformat.scale;
|
|
28
|
-
} else {
|
|
29
|
-
return _scale;
|
|
30
|
-
}
|
|
31
|
-
#else
|
|
32
|
-
return _scale;
|
|
33
|
-
#endif
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
- (void)setScale:(CGFloat)scale {
|
|
37
|
-
#if SD_UIKIT
|
|
38
|
-
if (@available(iOS 10.0, tvOS 10.10, *)) {
|
|
39
|
-
self.uiformat.scale = scale;
|
|
40
|
-
} else {
|
|
41
|
-
_scale = scale;
|
|
42
|
-
}
|
|
43
|
-
#else
|
|
44
|
-
_scale = scale;
|
|
45
|
-
#endif
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
- (BOOL)opaque {
|
|
49
|
-
#if SD_UIKIT
|
|
50
|
-
if (@available(iOS 10.0, tvOS 10.10, *)) {
|
|
51
|
-
return self.uiformat.opaque;
|
|
52
|
-
} else {
|
|
53
|
-
return _opaque;
|
|
54
|
-
}
|
|
55
|
-
#else
|
|
56
|
-
return _opaque;
|
|
57
|
-
#endif
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
- (void)setOpaque:(BOOL)opaque {
|
|
61
|
-
#if SD_UIKIT
|
|
62
|
-
if (@available(iOS 10.0, tvOS 10.10, *)) {
|
|
63
|
-
self.uiformat.opaque = opaque;
|
|
64
|
-
} else {
|
|
65
|
-
_opaque = opaque;
|
|
66
|
-
}
|
|
67
|
-
#else
|
|
68
|
-
_opaque = opaque;
|
|
69
|
-
#endif
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
#pragma clang diagnostic push
|
|
73
|
-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
74
|
-
- (SDGraphicsImageRendererFormatRange)preferredRange {
|
|
75
|
-
#if SD_UIKIT
|
|
76
|
-
if (@available(iOS 10.0, tvOS 10.10, *)) {
|
|
77
|
-
if (@available(iOS 12.0, tvOS 12.0, *)) {
|
|
78
|
-
return (SDGraphicsImageRendererFormatRange)self.uiformat.preferredRange;
|
|
79
|
-
} else {
|
|
80
|
-
BOOL prefersExtendedRange = self.uiformat.prefersExtendedRange;
|
|
81
|
-
if (prefersExtendedRange) {
|
|
82
|
-
return SDGraphicsImageRendererFormatRangeExtended;
|
|
83
|
-
} else {
|
|
84
|
-
return SDGraphicsImageRendererFormatRangeStandard;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
return _preferredRange;
|
|
89
|
-
}
|
|
90
|
-
#else
|
|
91
|
-
return _preferredRange;
|
|
92
|
-
#endif
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
- (void)setPreferredRange:(SDGraphicsImageRendererFormatRange)preferredRange {
|
|
96
|
-
#if SD_UIKIT
|
|
97
|
-
if (@available(iOS 10.0, tvOS 10.10, *)) {
|
|
98
|
-
if (@available(iOS 12.0, tvOS 12.0, *)) {
|
|
99
|
-
self.uiformat.preferredRange = (UIGraphicsImageRendererFormatRange)preferredRange;
|
|
100
|
-
} else {
|
|
101
|
-
switch (preferredRange) {
|
|
102
|
-
case SDGraphicsImageRendererFormatRangeExtended:
|
|
103
|
-
self.uiformat.prefersExtendedRange = YES;
|
|
104
|
-
break;
|
|
105
|
-
case SDGraphicsImageRendererFormatRangeStandard:
|
|
106
|
-
self.uiformat.prefersExtendedRange = NO;
|
|
107
|
-
default:
|
|
108
|
-
// Automatic means default
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
} else {
|
|
113
|
-
_preferredRange = preferredRange;
|
|
114
|
-
}
|
|
115
|
-
#else
|
|
116
|
-
_preferredRange = preferredRange;
|
|
117
|
-
#endif
|
|
118
|
-
}
|
|
119
|
-
#pragma clang diagnostic pop
|
|
120
|
-
|
|
121
|
-
- (instancetype)init {
|
|
122
|
-
self = [super init];
|
|
123
|
-
if (self) {
|
|
124
|
-
#if SD_UIKIT
|
|
125
|
-
if (@available(iOS 10.0, tvOS 10.10, *)) {
|
|
126
|
-
UIGraphicsImageRendererFormat *uiformat = [[UIGraphicsImageRendererFormat alloc] init];
|
|
127
|
-
self.uiformat = uiformat;
|
|
128
|
-
} else {
|
|
129
|
-
#endif
|
|
130
|
-
#if SD_WATCH
|
|
131
|
-
CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale;
|
|
132
|
-
#elif SD_UIKIT
|
|
133
|
-
CGFloat screenScale = [UIScreen mainScreen].scale;
|
|
134
|
-
#elif SD_MAC
|
|
135
|
-
NSScreen *mainScreen = nil;
|
|
136
|
-
if (@available(macOS 10.12, *)) {
|
|
137
|
-
mainScreen = [NSScreen mainScreen];
|
|
138
|
-
} else {
|
|
139
|
-
mainScreen = [NSScreen screens].firstObject;
|
|
140
|
-
}
|
|
141
|
-
CGFloat screenScale = mainScreen.backingScaleFactor ?: 1.0f;
|
|
142
|
-
#endif
|
|
143
|
-
self.scale = screenScale;
|
|
144
|
-
self.opaque = NO;
|
|
145
|
-
self.preferredRange = SDGraphicsImageRendererFormatRangeStandard;
|
|
146
|
-
#if SD_UIKIT
|
|
147
|
-
}
|
|
148
|
-
#endif
|
|
149
|
-
}
|
|
150
|
-
return self;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
#pragma clang diagnostic push
|
|
154
|
-
#pragma clang diagnostic ignored "-Wunguarded-availability"
|
|
155
|
-
- (instancetype)initForMainScreen {
|
|
156
|
-
self = [super init];
|
|
157
|
-
if (self) {
|
|
158
|
-
#if SD_UIKIT
|
|
159
|
-
if (@available(iOS 10.0, tvOS 10.0, *)) {
|
|
160
|
-
UIGraphicsImageRendererFormat *uiformat;
|
|
161
|
-
// iOS 11.0.0 GM does have `preferredFormat`, but iOS 11 betas did not (argh!)
|
|
162
|
-
if ([UIGraphicsImageRenderer respondsToSelector:@selector(preferredFormat)]) {
|
|
163
|
-
uiformat = [UIGraphicsImageRendererFormat preferredFormat];
|
|
164
|
-
} else {
|
|
165
|
-
uiformat = [UIGraphicsImageRendererFormat defaultFormat];
|
|
166
|
-
}
|
|
167
|
-
self.uiformat = uiformat;
|
|
168
|
-
} else {
|
|
169
|
-
#endif
|
|
170
|
-
#if SD_WATCH
|
|
171
|
-
CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale;
|
|
172
|
-
#elif SD_UIKIT
|
|
173
|
-
CGFloat screenScale = [UIScreen mainScreen].scale;
|
|
174
|
-
#elif SD_MAC
|
|
175
|
-
NSScreen *mainScreen = nil;
|
|
176
|
-
if (@available(macOS 10.12, *)) {
|
|
177
|
-
mainScreen = [NSScreen mainScreen];
|
|
178
|
-
} else {
|
|
179
|
-
mainScreen = [NSScreen screens].firstObject;
|
|
180
|
-
}
|
|
181
|
-
CGFloat screenScale = mainScreen.backingScaleFactor ?: 1.0f;
|
|
182
|
-
#endif
|
|
183
|
-
self.scale = screenScale;
|
|
184
|
-
self.opaque = NO;
|
|
185
|
-
self.preferredRange = SDGraphicsImageRendererFormatRangeStandard;
|
|
186
|
-
#if SD_UIKIT
|
|
187
|
-
}
|
|
188
|
-
#endif
|
|
189
|
-
}
|
|
190
|
-
return self;
|
|
191
|
-
}
|
|
192
|
-
#pragma clang diagnostic pop
|
|
193
|
-
|
|
194
|
-
+ (instancetype)preferredFormat {
|
|
195
|
-
SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] initForMainScreen];
|
|
196
|
-
return format;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
@end
|
|
200
|
-
|
|
201
|
-
@interface SDGraphicsImageRenderer ()
|
|
202
|
-
@property (nonatomic, assign) CGSize size;
|
|
203
|
-
@property (nonatomic, strong) SDGraphicsImageRendererFormat *format;
|
|
204
|
-
#if SD_UIKIT
|
|
205
|
-
@property (nonatomic, strong) UIGraphicsImageRenderer *uirenderer API_AVAILABLE(ios(10.0), tvos(10.0));
|
|
206
|
-
#endif
|
|
207
|
-
@end
|
|
208
|
-
|
|
209
|
-
@implementation SDGraphicsImageRenderer
|
|
210
|
-
|
|
211
|
-
- (instancetype)initWithSize:(CGSize)size {
|
|
212
|
-
return [self initWithSize:size format:SDGraphicsImageRendererFormat.preferredFormat];
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
- (instancetype)initWithSize:(CGSize)size format:(SDGraphicsImageRendererFormat *)format {
|
|
216
|
-
NSParameterAssert(format);
|
|
217
|
-
self = [super init];
|
|
218
|
-
if (self) {
|
|
219
|
-
self.size = size;
|
|
220
|
-
self.format = format;
|
|
221
|
-
#if SD_UIKIT
|
|
222
|
-
if (@available(iOS 10.0, tvOS 10.0, *)) {
|
|
223
|
-
UIGraphicsImageRendererFormat *uiformat = format.uiformat;
|
|
224
|
-
self.uirenderer = [[UIGraphicsImageRenderer alloc] initWithSize:size format:uiformat];
|
|
225
|
-
}
|
|
226
|
-
#endif
|
|
227
|
-
}
|
|
228
|
-
return self;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
- (UIImage *)imageWithActions:(NS_NOESCAPE SDGraphicsImageDrawingActions)actions {
|
|
232
|
-
NSParameterAssert(actions);
|
|
233
|
-
#if SD_UIKIT
|
|
234
|
-
if (@available(iOS 10.0, tvOS 10.0, *)) {
|
|
235
|
-
UIGraphicsImageDrawingActions uiactions = ^(UIGraphicsImageRendererContext *rendererContext) {
|
|
236
|
-
if (actions) {
|
|
237
|
-
actions(rendererContext.CGContext);
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
return [self.uirenderer imageWithActions:uiactions];
|
|
241
|
-
} else {
|
|
242
|
-
#endif
|
|
243
|
-
SDGraphicsBeginImageContextWithOptions(self.size, self.format.opaque, self.format.scale);
|
|
244
|
-
CGContextRef context = SDGraphicsGetCurrentContext();
|
|
245
|
-
if (actions) {
|
|
246
|
-
actions(context);
|
|
247
|
-
}
|
|
248
|
-
UIImage *image = SDGraphicsGetImageFromCurrentImageContext();
|
|
249
|
-
SDGraphicsEndImageContext();
|
|
250
|
-
return image;
|
|
251
|
-
#if SD_UIKIT
|
|
252
|
-
}
|
|
253
|
-
#endif
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
@end
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|