@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,775 +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 "SDWebImageManager.h"
|
|
10
|
-
#import "SDImageCache.h"
|
|
11
|
-
#import "SDWebImageDownloader.h"
|
|
12
|
-
#import "UIImage+Metadata.h"
|
|
13
|
-
#import "SDAssociatedObject.h"
|
|
14
|
-
#import "SDWebImageError.h"
|
|
15
|
-
#import "SDInternalMacros.h"
|
|
16
|
-
|
|
17
|
-
static id<SDImageCache> _defaultImageCache;
|
|
18
|
-
static id<SDImageLoader> _defaultImageLoader;
|
|
19
|
-
|
|
20
|
-
@interface SDWebImageCombinedOperation ()
|
|
21
|
-
|
|
22
|
-
@property (assign, nonatomic, getter = isCancelled) BOOL cancelled;
|
|
23
|
-
@property (strong, nonatomic, readwrite, nullable) id<SDWebImageOperation> loaderOperation;
|
|
24
|
-
@property (strong, nonatomic, readwrite, nullable) id<SDWebImageOperation> cacheOperation;
|
|
25
|
-
@property (weak, nonatomic, nullable) SDWebImageManager *manager;
|
|
26
|
-
|
|
27
|
-
@end
|
|
28
|
-
|
|
29
|
-
@interface SDWebImageManager () {
|
|
30
|
-
SD_LOCK_DECLARE(_failedURLsLock); // a lock to keep the access to `failedURLs` thread-safe
|
|
31
|
-
SD_LOCK_DECLARE(_runningOperationsLock); // a lock to keep the access to `runningOperations` thread-safe
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@property (strong, nonatomic, readwrite, nonnull) SDImageCache *imageCache;
|
|
35
|
-
@property (strong, nonatomic, readwrite, nonnull) id<SDImageLoader> imageLoader;
|
|
36
|
-
@property (strong, nonatomic, nonnull) NSMutableSet<NSURL *> *failedURLs;
|
|
37
|
-
@property (strong, nonatomic, nonnull) NSMutableSet<SDWebImageCombinedOperation *> *runningOperations;
|
|
38
|
-
|
|
39
|
-
@end
|
|
40
|
-
|
|
41
|
-
@implementation SDWebImageManager
|
|
42
|
-
|
|
43
|
-
+ (id<SDImageCache>)defaultImageCache {
|
|
44
|
-
return _defaultImageCache;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
+ (void)setDefaultImageCache:(id<SDImageCache>)defaultImageCache {
|
|
48
|
-
if (defaultImageCache && ![defaultImageCache conformsToProtocol:@protocol(SDImageCache)]) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
_defaultImageCache = defaultImageCache;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
+ (id<SDImageLoader>)defaultImageLoader {
|
|
55
|
-
return _defaultImageLoader;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
+ (void)setDefaultImageLoader:(id<SDImageLoader>)defaultImageLoader {
|
|
59
|
-
if (defaultImageLoader && ![defaultImageLoader conformsToProtocol:@protocol(SDImageLoader)]) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
_defaultImageLoader = defaultImageLoader;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
+ (nonnull instancetype)sharedManager {
|
|
66
|
-
static dispatch_once_t once;
|
|
67
|
-
static id instance;
|
|
68
|
-
dispatch_once(&once, ^{
|
|
69
|
-
instance = [self new];
|
|
70
|
-
});
|
|
71
|
-
return instance;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
- (nonnull instancetype)init {
|
|
75
|
-
id<SDImageCache> cache = [[self class] defaultImageCache];
|
|
76
|
-
if (!cache) {
|
|
77
|
-
cache = [SDImageCache sharedImageCache];
|
|
78
|
-
}
|
|
79
|
-
id<SDImageLoader> loader = [[self class] defaultImageLoader];
|
|
80
|
-
if (!loader) {
|
|
81
|
-
loader = [SDWebImageDownloader sharedDownloader];
|
|
82
|
-
}
|
|
83
|
-
return [self initWithCache:cache loader:loader];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
- (nonnull instancetype)initWithCache:(nonnull id<SDImageCache>)cache loader:(nonnull id<SDImageLoader>)loader {
|
|
87
|
-
if ((self = [super init])) {
|
|
88
|
-
_imageCache = cache;
|
|
89
|
-
_imageLoader = loader;
|
|
90
|
-
_failedURLs = [NSMutableSet new];
|
|
91
|
-
SD_LOCK_INIT(_failedURLsLock);
|
|
92
|
-
_runningOperations = [NSMutableSet new];
|
|
93
|
-
SD_LOCK_INIT(_runningOperationsLock);
|
|
94
|
-
}
|
|
95
|
-
return self;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url {
|
|
99
|
-
if (!url) {
|
|
100
|
-
return @"";
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
NSString *key;
|
|
104
|
-
// Cache Key Filter
|
|
105
|
-
id<SDWebImageCacheKeyFilter> cacheKeyFilter = self.cacheKeyFilter;
|
|
106
|
-
if (cacheKeyFilter) {
|
|
107
|
-
key = [cacheKeyFilter cacheKeyForURL:url];
|
|
108
|
-
} else {
|
|
109
|
-
key = url.absoluteString;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return key;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
- (nullable NSString *)originalCacheKeyForURL:(nullable NSURL *)url context:(nullable SDWebImageContext *)context {
|
|
116
|
-
if (!url) {
|
|
117
|
-
return @"";
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
NSString *key;
|
|
121
|
-
// Cache Key Filter
|
|
122
|
-
id<SDWebImageCacheKeyFilter> cacheKeyFilter = self.cacheKeyFilter;
|
|
123
|
-
if (context[SDWebImageContextCacheKeyFilter]) {
|
|
124
|
-
cacheKeyFilter = context[SDWebImageContextCacheKeyFilter];
|
|
125
|
-
}
|
|
126
|
-
if (cacheKeyFilter) {
|
|
127
|
-
key = [cacheKeyFilter cacheKeyForURL:url];
|
|
128
|
-
} else {
|
|
129
|
-
key = url.absoluteString;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return key;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url context:(nullable SDWebImageContext *)context {
|
|
136
|
-
if (!url) {
|
|
137
|
-
return @"";
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
NSString *key;
|
|
141
|
-
// Cache Key Filter
|
|
142
|
-
id<SDWebImageCacheKeyFilter> cacheKeyFilter = self.cacheKeyFilter;
|
|
143
|
-
if (context[SDWebImageContextCacheKeyFilter]) {
|
|
144
|
-
cacheKeyFilter = context[SDWebImageContextCacheKeyFilter];
|
|
145
|
-
}
|
|
146
|
-
if (cacheKeyFilter) {
|
|
147
|
-
key = [cacheKeyFilter cacheKeyForURL:url];
|
|
148
|
-
} else {
|
|
149
|
-
key = url.absoluteString;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Thumbnail Key Appending
|
|
153
|
-
NSValue *thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];
|
|
154
|
-
if (thumbnailSizeValue != nil) {
|
|
155
|
-
CGSize thumbnailSize = CGSizeZero;
|
|
156
|
-
#if SD_MAC
|
|
157
|
-
thumbnailSize = thumbnailSizeValue.sizeValue;
|
|
158
|
-
#else
|
|
159
|
-
thumbnailSize = thumbnailSizeValue.CGSizeValue;
|
|
160
|
-
#endif
|
|
161
|
-
BOOL preserveAspectRatio = YES;
|
|
162
|
-
NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];
|
|
163
|
-
if (preserveAspectRatioValue != nil) {
|
|
164
|
-
preserveAspectRatio = preserveAspectRatioValue.boolValue;
|
|
165
|
-
}
|
|
166
|
-
key = SDThumbnailedKeyForKey(key, thumbnailSize, preserveAspectRatio);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Transformer Key Appending
|
|
170
|
-
id<SDImageTransformer> transformer = self.transformer;
|
|
171
|
-
if (context[SDWebImageContextImageTransformer]) {
|
|
172
|
-
transformer = context[SDWebImageContextImageTransformer];
|
|
173
|
-
if ([transformer isEqual:NSNull.null]) {
|
|
174
|
-
transformer = nil;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (transformer) {
|
|
178
|
-
key = SDTransformedKeyForKey(key, transformer.transformerKey);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return key;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
- (SDWebImageCombinedOperation *)loadImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDInternalCompletionBlock)completedBlock {
|
|
185
|
-
return [self loadImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
- (SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url
|
|
189
|
-
options:(SDWebImageOptions)options
|
|
190
|
-
context:(nullable SDWebImageContext *)context
|
|
191
|
-
progress:(nullable SDImageLoaderProgressBlock)progressBlock
|
|
192
|
-
completed:(nonnull SDInternalCompletionBlock)completedBlock {
|
|
193
|
-
// Invoking this method without a completedBlock is pointless
|
|
194
|
-
NSAssert(completedBlock != nil, @"If you mean to prefetch the image, use -[SDWebImagePrefetcher prefetchURLs] instead");
|
|
195
|
-
|
|
196
|
-
// Very common mistake is to send the URL using NSString object instead of NSURL. For some strange reason, Xcode won't
|
|
197
|
-
// throw any warning for this type mismatch. Here we failsafe this error by allowing URLs to be passed as NSString.
|
|
198
|
-
if ([url isKindOfClass:NSString.class]) {
|
|
199
|
-
url = [NSURL URLWithString:(NSString *)url];
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// Prevents app crashing on argument type error like sending NSNull instead of NSURL
|
|
203
|
-
if (![url isKindOfClass:NSURL.class]) {
|
|
204
|
-
url = nil;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
SDWebImageCombinedOperation *operation = [SDWebImageCombinedOperation new];
|
|
208
|
-
operation.manager = self;
|
|
209
|
-
|
|
210
|
-
BOOL isFailedUrl = NO;
|
|
211
|
-
if (url) {
|
|
212
|
-
SD_LOCK(_failedURLsLock);
|
|
213
|
-
isFailedUrl = [self.failedURLs containsObject:url];
|
|
214
|
-
SD_UNLOCK(_failedURLsLock);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (url.absoluteString.length == 0 || (!(options & SDWebImageRetryFailed) && isFailedUrl)) {
|
|
218
|
-
NSString *description = isFailedUrl ? @"Image url is blacklisted" : @"Image url is nil";
|
|
219
|
-
NSInteger code = isFailedUrl ? SDWebImageErrorBlackListed : SDWebImageErrorInvalidURL;
|
|
220
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey : description}] url:url];
|
|
221
|
-
return operation;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
SD_LOCK(_runningOperationsLock);
|
|
225
|
-
[self.runningOperations addObject:operation];
|
|
226
|
-
SD_UNLOCK(_runningOperationsLock);
|
|
227
|
-
|
|
228
|
-
// Preprocess the options and context arg to decide the final the result for manager
|
|
229
|
-
SDWebImageOptionsResult *result = [self processedResultForURL:url options:options context:context];
|
|
230
|
-
|
|
231
|
-
// Start the entry to load image from cache, the longest steps are below
|
|
232
|
-
// Steps without transformer:
|
|
233
|
-
// 1. query image from cache, miss
|
|
234
|
-
// 2. download data and image
|
|
235
|
-
// 3. store image to cache
|
|
236
|
-
|
|
237
|
-
// Steps with transformer:
|
|
238
|
-
// 1. query transformed image from cache, miss
|
|
239
|
-
// 2. query original image from cache, miss
|
|
240
|
-
// 3. download data and image
|
|
241
|
-
// 4. do transform in CPU
|
|
242
|
-
// 5. store original image to cache
|
|
243
|
-
// 6. store transformed image to cache
|
|
244
|
-
[self callCacheProcessForOperation:operation url:url options:result.options context:result.context progress:progressBlock completed:completedBlock];
|
|
245
|
-
|
|
246
|
-
return operation;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
- (void)cancelAll {
|
|
250
|
-
SD_LOCK(_runningOperationsLock);
|
|
251
|
-
NSSet<SDWebImageCombinedOperation *> *copiedOperations = [self.runningOperations copy];
|
|
252
|
-
SD_UNLOCK(_runningOperationsLock);
|
|
253
|
-
[copiedOperations makeObjectsPerformSelector:@selector(cancel)]; // This will call `safelyRemoveOperationFromRunning:` and remove from the array
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
- (BOOL)isRunning {
|
|
257
|
-
BOOL isRunning = NO;
|
|
258
|
-
SD_LOCK(_runningOperationsLock);
|
|
259
|
-
isRunning = (self.runningOperations.count > 0);
|
|
260
|
-
SD_UNLOCK(_runningOperationsLock);
|
|
261
|
-
return isRunning;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
- (void)removeFailedURL:(NSURL *)url {
|
|
265
|
-
if (!url) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
SD_LOCK(_failedURLsLock);
|
|
269
|
-
[self.failedURLs removeObject:url];
|
|
270
|
-
SD_UNLOCK(_failedURLsLock);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
- (void)removeAllFailedURLs {
|
|
274
|
-
SD_LOCK(_failedURLsLock);
|
|
275
|
-
[self.failedURLs removeAllObjects];
|
|
276
|
-
SD_UNLOCK(_failedURLsLock);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
#pragma mark - Private
|
|
280
|
-
|
|
281
|
-
// Query normal cache process
|
|
282
|
-
- (void)callCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation
|
|
283
|
-
url:(nonnull NSURL *)url
|
|
284
|
-
options:(SDWebImageOptions)options
|
|
285
|
-
context:(nullable SDWebImageContext *)context
|
|
286
|
-
progress:(nullable SDImageLoaderProgressBlock)progressBlock
|
|
287
|
-
completed:(nullable SDInternalCompletionBlock)completedBlock {
|
|
288
|
-
// Grab the image cache to use
|
|
289
|
-
id<SDImageCache> imageCache = context[SDWebImageContextImageCache];
|
|
290
|
-
if (!imageCache) {
|
|
291
|
-
imageCache = self.imageCache;
|
|
292
|
-
}
|
|
293
|
-
// Get the query cache type
|
|
294
|
-
SDImageCacheType queryCacheType = SDImageCacheTypeAll;
|
|
295
|
-
if (context[SDWebImageContextQueryCacheType]) {
|
|
296
|
-
queryCacheType = [context[SDWebImageContextQueryCacheType] integerValue];
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// Check whether we should query cache
|
|
300
|
-
BOOL shouldQueryCache = !SD_OPTIONS_CONTAINS(options, SDWebImageFromLoaderOnly);
|
|
301
|
-
if (shouldQueryCache) {
|
|
302
|
-
// transformed cache key
|
|
303
|
-
NSString *key = [self cacheKeyForURL:url context:context];
|
|
304
|
-
@weakify(operation);
|
|
305
|
-
operation.cacheOperation = [imageCache queryImageForKey:key options:options context:context cacheType:queryCacheType completion:^(UIImage * _Nullable cachedImage, NSData * _Nullable cachedData, SDImageCacheType cacheType) {
|
|
306
|
-
@strongify(operation);
|
|
307
|
-
if (!operation || operation.isCancelled) {
|
|
308
|
-
// Image combined operation cancelled by user
|
|
309
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during querying the cache"}] url:url];
|
|
310
|
-
[self safelyRemoveOperationFromRunning:operation];
|
|
311
|
-
return;
|
|
312
|
-
} else if (!cachedImage) {
|
|
313
|
-
NSString *originKey = [self originalCacheKeyForURL:url context:context];
|
|
314
|
-
BOOL mayInOriginalCache = ![key isEqualToString:originKey];
|
|
315
|
-
// Have a chance to query original cache instead of downloading, then applying transform
|
|
316
|
-
// Thumbnail decoding is done inside SDImageCache's decoding part, which does not need post processing for transform
|
|
317
|
-
if (mayInOriginalCache) {
|
|
318
|
-
[self callOriginalCacheProcessForOperation:operation url:url options:options context:context progress:progressBlock completed:completedBlock];
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
// Continue download process
|
|
323
|
-
[self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:cachedImage cachedData:cachedData cacheType:cacheType progress:progressBlock completed:completedBlock];
|
|
324
|
-
}];
|
|
325
|
-
} else {
|
|
326
|
-
// Continue download process
|
|
327
|
-
[self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:SDImageCacheTypeNone progress:progressBlock completed:completedBlock];
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// Query original cache process
|
|
332
|
-
- (void)callOriginalCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation
|
|
333
|
-
url:(nonnull NSURL *)url
|
|
334
|
-
options:(SDWebImageOptions)options
|
|
335
|
-
context:(nullable SDWebImageContext *)context
|
|
336
|
-
progress:(nullable SDImageLoaderProgressBlock)progressBlock
|
|
337
|
-
completed:(nullable SDInternalCompletionBlock)completedBlock {
|
|
338
|
-
// Grab the image cache to use, choose standalone original cache firstly
|
|
339
|
-
id<SDImageCache> imageCache = context[SDWebImageContextOriginalImageCache];
|
|
340
|
-
if (!imageCache) {
|
|
341
|
-
// if no standalone cache available, use default cache
|
|
342
|
-
imageCache = context[SDWebImageContextImageCache];
|
|
343
|
-
if (!imageCache) {
|
|
344
|
-
imageCache = self.imageCache;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
// Get the original query cache type
|
|
348
|
-
SDImageCacheType originalQueryCacheType = SDImageCacheTypeDisk;
|
|
349
|
-
if (context[SDWebImageContextOriginalQueryCacheType]) {
|
|
350
|
-
originalQueryCacheType = [context[SDWebImageContextOriginalQueryCacheType] integerValue];
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
// Check whether we should query original cache
|
|
354
|
-
BOOL shouldQueryOriginalCache = (originalQueryCacheType != SDImageCacheTypeNone);
|
|
355
|
-
if (shouldQueryOriginalCache) {
|
|
356
|
-
// Get original cache key generation without transformer
|
|
357
|
-
NSString *key = [self originalCacheKeyForURL:url context:context];
|
|
358
|
-
@weakify(operation);
|
|
359
|
-
operation.cacheOperation = [imageCache queryImageForKey:key options:options context:context cacheType:originalQueryCacheType completion:^(UIImage * _Nullable cachedImage, NSData * _Nullable cachedData, SDImageCacheType cacheType) {
|
|
360
|
-
@strongify(operation);
|
|
361
|
-
if (!operation || operation.isCancelled) {
|
|
362
|
-
// Image combined operation cancelled by user
|
|
363
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during querying the cache"}] url:url];
|
|
364
|
-
[self safelyRemoveOperationFromRunning:operation];
|
|
365
|
-
return;
|
|
366
|
-
} else if (!cachedImage) {
|
|
367
|
-
// Original image cache miss. Continue download process
|
|
368
|
-
[self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:SDImageCacheTypeNone progress:progressBlock completed:completedBlock];
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// Skip downloading and continue transform process, and ignore .refreshCached option for now
|
|
373
|
-
[self callTransformProcessForOperation:operation url:url options:options context:context originalImage:cachedImage originalData:cachedData cacheType:cacheType finished:YES completed:completedBlock];
|
|
374
|
-
|
|
375
|
-
[self safelyRemoveOperationFromRunning:operation];
|
|
376
|
-
}];
|
|
377
|
-
} else {
|
|
378
|
-
// Continue download process
|
|
379
|
-
[self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:SDImageCacheTypeNone progress:progressBlock completed:completedBlock];
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// Download process
|
|
384
|
-
- (void)callDownloadProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation
|
|
385
|
-
url:(nonnull NSURL *)url
|
|
386
|
-
options:(SDWebImageOptions)options
|
|
387
|
-
context:(SDWebImageContext *)context
|
|
388
|
-
cachedImage:(nullable UIImage *)cachedImage
|
|
389
|
-
cachedData:(nullable NSData *)cachedData
|
|
390
|
-
cacheType:(SDImageCacheType)cacheType
|
|
391
|
-
progress:(nullable SDImageLoaderProgressBlock)progressBlock
|
|
392
|
-
completed:(nullable SDInternalCompletionBlock)completedBlock {
|
|
393
|
-
// Mark the cache operation end
|
|
394
|
-
@synchronized (operation) {
|
|
395
|
-
operation.cacheOperation = nil;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
// Grab the image loader to use
|
|
399
|
-
id<SDImageLoader> imageLoader = context[SDWebImageContextImageLoader];
|
|
400
|
-
if (!imageLoader) {
|
|
401
|
-
imageLoader = self.imageLoader;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// Check whether we should download image from network
|
|
405
|
-
BOOL shouldDownload = !SD_OPTIONS_CONTAINS(options, SDWebImageFromCacheOnly);
|
|
406
|
-
shouldDownload &= (!cachedImage || options & SDWebImageRefreshCached);
|
|
407
|
-
shouldDownload &= (![self.delegate respondsToSelector:@selector(imageManager:shouldDownloadImageForURL:)] || [self.delegate imageManager:self shouldDownloadImageForURL:url]);
|
|
408
|
-
if ([imageLoader respondsToSelector:@selector(canRequestImageForURL:options:context:)]) {
|
|
409
|
-
shouldDownload &= [imageLoader canRequestImageForURL:url options:options context:context];
|
|
410
|
-
} else {
|
|
411
|
-
shouldDownload &= [imageLoader canRequestImageForURL:url];
|
|
412
|
-
}
|
|
413
|
-
if (shouldDownload) {
|
|
414
|
-
if (cachedImage && options & SDWebImageRefreshCached) {
|
|
415
|
-
// If image was found in the cache but SDWebImageRefreshCached is provided, notify about the cached image
|
|
416
|
-
// AND try to re-download it in order to let a chance to NSURLCache to refresh it from server.
|
|
417
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url];
|
|
418
|
-
// Pass the cached image to the image loader. The image loader should check whether the remote image is equal to the cached image.
|
|
419
|
-
SDWebImageMutableContext *mutableContext;
|
|
420
|
-
if (context) {
|
|
421
|
-
mutableContext = [context mutableCopy];
|
|
422
|
-
} else {
|
|
423
|
-
mutableContext = [NSMutableDictionary dictionary];
|
|
424
|
-
}
|
|
425
|
-
mutableContext[SDWebImageContextLoaderCachedImage] = cachedImage;
|
|
426
|
-
context = [mutableContext copy];
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
@weakify(operation);
|
|
430
|
-
operation.loaderOperation = [imageLoader requestImageWithURL:url options:options context:context progress:progressBlock completed:^(UIImage *downloadedImage, NSData *downloadedData, NSError *error, BOOL finished) {
|
|
431
|
-
@strongify(operation);
|
|
432
|
-
if (!operation || operation.isCancelled) {
|
|
433
|
-
// Image combined operation cancelled by user
|
|
434
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during sending the request"}] url:url];
|
|
435
|
-
} else if (cachedImage && options & SDWebImageRefreshCached && [error.domain isEqualToString:SDWebImageErrorDomain] && error.code == SDWebImageErrorCacheNotModified) {
|
|
436
|
-
// Image refresh hit the NSURLCache cache, do not call the completion block
|
|
437
|
-
} else if ([error.domain isEqualToString:SDWebImageErrorDomain] && error.code == SDWebImageErrorCancelled) {
|
|
438
|
-
// Download operation cancelled by user before sending the request, don't block failed URL
|
|
439
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock error:error url:url];
|
|
440
|
-
} else if (error) {
|
|
441
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock error:error url:url];
|
|
442
|
-
BOOL shouldBlockFailedURL = [self shouldBlockFailedURLWithURL:url error:error options:options context:context];
|
|
443
|
-
|
|
444
|
-
if (shouldBlockFailedURL) {
|
|
445
|
-
SD_LOCK(self->_failedURLsLock);
|
|
446
|
-
[self.failedURLs addObject:url];
|
|
447
|
-
SD_UNLOCK(self->_failedURLsLock);
|
|
448
|
-
}
|
|
449
|
-
} else {
|
|
450
|
-
if ((options & SDWebImageRetryFailed)) {
|
|
451
|
-
SD_LOCK(self->_failedURLsLock);
|
|
452
|
-
[self.failedURLs removeObject:url];
|
|
453
|
-
SD_UNLOCK(self->_failedURLsLock);
|
|
454
|
-
}
|
|
455
|
-
// Continue transform process
|
|
456
|
-
[self callTransformProcessForOperation:operation url:url options:options context:context originalImage:downloadedImage originalData:downloadedData cacheType:SDImageCacheTypeNone finished:finished completed:completedBlock];
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
if (finished) {
|
|
460
|
-
[self safelyRemoveOperationFromRunning:operation];
|
|
461
|
-
}
|
|
462
|
-
}];
|
|
463
|
-
} else if (cachedImage) {
|
|
464
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url];
|
|
465
|
-
[self safelyRemoveOperationFromRunning:operation];
|
|
466
|
-
} else {
|
|
467
|
-
// Image not in cache and download disallowed by delegate
|
|
468
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock image:nil data:nil error:nil cacheType:SDImageCacheTypeNone finished:YES url:url];
|
|
469
|
-
[self safelyRemoveOperationFromRunning:operation];
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// Transform process
|
|
474
|
-
- (void)callTransformProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation
|
|
475
|
-
url:(nonnull NSURL *)url
|
|
476
|
-
options:(SDWebImageOptions)options
|
|
477
|
-
context:(SDWebImageContext *)context
|
|
478
|
-
originalImage:(nullable UIImage *)originalImage
|
|
479
|
-
originalData:(nullable NSData *)originalData
|
|
480
|
-
cacheType:(SDImageCacheType)cacheType
|
|
481
|
-
finished:(BOOL)finished
|
|
482
|
-
completed:(nullable SDInternalCompletionBlock)completedBlock {
|
|
483
|
-
id<SDImageTransformer> transformer = context[SDWebImageContextImageTransformer];
|
|
484
|
-
if ([transformer isEqual:NSNull.null]) {
|
|
485
|
-
transformer = nil;
|
|
486
|
-
}
|
|
487
|
-
// transformer check
|
|
488
|
-
BOOL shouldTransformImage = originalImage && transformer;
|
|
489
|
-
shouldTransformImage = shouldTransformImage && (!originalImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage));
|
|
490
|
-
shouldTransformImage = shouldTransformImage && (!originalImage.sd_isVector || (options & SDWebImageTransformVectorImage));
|
|
491
|
-
// thumbnail check
|
|
492
|
-
BOOL isThumbnail = originalImage.sd_isThumbnail;
|
|
493
|
-
NSData *cacheData = originalData;
|
|
494
|
-
UIImage *cacheImage = originalImage;
|
|
495
|
-
if (isThumbnail) {
|
|
496
|
-
cacheData = nil; // thumbnail don't store full size data
|
|
497
|
-
originalImage = nil; // thumbnail don't have full size image
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
if (shouldTransformImage) {
|
|
501
|
-
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
|
502
|
-
@autoreleasepool {
|
|
503
|
-
// transformed cache key
|
|
504
|
-
NSString *key = [self cacheKeyForURL:url context:context];
|
|
505
|
-
// Case that transformer on thumbnail, which this time need full pixel image
|
|
506
|
-
UIImage *transformedImage = [transformer transformedImageWithImage:cacheImage forKey:key];
|
|
507
|
-
if (transformedImage) {
|
|
508
|
-
transformedImage.sd_isTransformed = YES;
|
|
509
|
-
[self callStoreOriginCacheProcessForOperation:operation url:url options:options context:context originalImage:originalImage cacheImage:transformedImage originalData:originalData cacheData:nil cacheType:cacheType finished:finished completed:completedBlock];
|
|
510
|
-
} else {
|
|
511
|
-
[self callStoreOriginCacheProcessForOperation:operation url:url options:options context:context originalImage:originalImage cacheImage:cacheImage originalData:originalData cacheData:cacheData cacheType:cacheType finished:finished completed:completedBlock];
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
} else {
|
|
516
|
-
[self callStoreOriginCacheProcessForOperation:operation url:url options:options context:context originalImage:originalImage cacheImage:cacheImage originalData:originalData cacheData:cacheData cacheType:cacheType finished:finished completed:completedBlock];
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
// Store origin cache process
|
|
521
|
-
- (void)callStoreOriginCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation
|
|
522
|
-
url:(nonnull NSURL *)url
|
|
523
|
-
options:(SDWebImageOptions)options
|
|
524
|
-
context:(SDWebImageContext *)context
|
|
525
|
-
originalImage:(nullable UIImage *)originalImage
|
|
526
|
-
cacheImage:(nullable UIImage *)cacheImage
|
|
527
|
-
originalData:(nullable NSData *)originalData
|
|
528
|
-
cacheData:(nullable NSData *)cacheData
|
|
529
|
-
cacheType:(SDImageCacheType)cacheType
|
|
530
|
-
finished:(BOOL)finished
|
|
531
|
-
completed:(nullable SDInternalCompletionBlock)completedBlock {
|
|
532
|
-
// Grab the image cache to use, choose standalone original cache firstly
|
|
533
|
-
id<SDImageCache> imageCache = context[SDWebImageContextOriginalImageCache];
|
|
534
|
-
if (!imageCache) {
|
|
535
|
-
// if no standalone cache available, use default cache
|
|
536
|
-
imageCache = context[SDWebImageContextImageCache];
|
|
537
|
-
if (!imageCache) {
|
|
538
|
-
imageCache = self.imageCache;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
BOOL waitStoreCache = SD_OPTIONS_CONTAINS(options, SDWebImageWaitStoreCache);
|
|
542
|
-
// the original store image cache type
|
|
543
|
-
SDImageCacheType originalStoreCacheType = SDImageCacheTypeDisk;
|
|
544
|
-
if (context[SDWebImageContextOriginalStoreCacheType]) {
|
|
545
|
-
originalStoreCacheType = [context[SDWebImageContextOriginalStoreCacheType] integerValue];
|
|
546
|
-
}
|
|
547
|
-
id<SDWebImageCacheSerializer> cacheSerializer = context[SDWebImageContextCacheSerializer];
|
|
548
|
-
|
|
549
|
-
// If the original cacheType is disk, since we don't need to store the original data again
|
|
550
|
-
// Strip the disk from the originalStoreCacheType
|
|
551
|
-
if (cacheType == SDImageCacheTypeDisk) {
|
|
552
|
-
if (originalStoreCacheType == SDImageCacheTypeDisk) originalStoreCacheType = SDImageCacheTypeNone;
|
|
553
|
-
if (originalStoreCacheType == SDImageCacheTypeAll) originalStoreCacheType = SDImageCacheTypeMemory;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
// Get original cache key generation without transformer
|
|
557
|
-
NSString *key = [self originalCacheKeyForURL:url context:context];
|
|
558
|
-
if (finished && cacheSerializer && (originalStoreCacheType == SDImageCacheTypeDisk || originalStoreCacheType == SDImageCacheTypeAll)) {
|
|
559
|
-
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
|
560
|
-
@autoreleasepool {
|
|
561
|
-
NSData *newOriginalData = [cacheSerializer cacheDataWithImage:originalImage originalData:originalData imageURL:url];
|
|
562
|
-
// Store original image and data
|
|
563
|
-
[self storeImage:originalImage imageData:newOriginalData forKey:key imageCache:imageCache cacheType:originalStoreCacheType finished:finished waitStoreCache:waitStoreCache completion:^{
|
|
564
|
-
// Continue store cache process, transformed data is nil
|
|
565
|
-
[self callStoreCacheProcessForOperation:operation url:url options:options context:context image:cacheImage data:cacheData cacheType:cacheType finished:finished completed:completedBlock];
|
|
566
|
-
}];
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
} else {
|
|
570
|
-
// Store original image and data
|
|
571
|
-
[self storeImage:originalImage imageData:originalData forKey:key imageCache:imageCache cacheType:originalStoreCacheType finished:finished waitStoreCache:waitStoreCache completion:^{
|
|
572
|
-
// Continue store cache process, transformed data is nil
|
|
573
|
-
[self callStoreCacheProcessForOperation:operation url:url options:options context:context image:cacheImage data:cacheData cacheType:cacheType finished:finished completed:completedBlock];
|
|
574
|
-
}];
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
// Store normal cache process
|
|
579
|
-
- (void)callStoreCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation
|
|
580
|
-
url:(nonnull NSURL *)url
|
|
581
|
-
options:(SDWebImageOptions)options
|
|
582
|
-
context:(SDWebImageContext *)context
|
|
583
|
-
image:(nullable UIImage *)image
|
|
584
|
-
data:(nullable NSData *)data
|
|
585
|
-
cacheType:(SDImageCacheType)cacheType
|
|
586
|
-
finished:(BOOL)finished
|
|
587
|
-
completed:(nullable SDInternalCompletionBlock)completedBlock {
|
|
588
|
-
// Grab the image cache to use
|
|
589
|
-
id<SDImageCache> imageCache = context[SDWebImageContextImageCache];
|
|
590
|
-
if (!imageCache) {
|
|
591
|
-
imageCache = self.imageCache;
|
|
592
|
-
}
|
|
593
|
-
BOOL waitStoreCache = SD_OPTIONS_CONTAINS(options, SDWebImageWaitStoreCache);
|
|
594
|
-
// the target image store cache type
|
|
595
|
-
SDImageCacheType storeCacheType = SDImageCacheTypeAll;
|
|
596
|
-
if (context[SDWebImageContextStoreCacheType]) {
|
|
597
|
-
storeCacheType = [context[SDWebImageContextStoreCacheType] integerValue];
|
|
598
|
-
}
|
|
599
|
-
id<SDWebImageCacheSerializer> cacheSerializer = context[SDWebImageContextCacheSerializer];
|
|
600
|
-
|
|
601
|
-
// transformed cache key
|
|
602
|
-
NSString *key = [self cacheKeyForURL:url context:context];
|
|
603
|
-
if (finished && cacheSerializer && (storeCacheType == SDImageCacheTypeDisk || storeCacheType == SDImageCacheTypeAll)) {
|
|
604
|
-
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
|
605
|
-
NSData *newData = [cacheSerializer cacheDataWithImage:image originalData:data imageURL:url];
|
|
606
|
-
// Store image and data
|
|
607
|
-
[self storeImage:image imageData:newData forKey:key imageCache:imageCache cacheType:storeCacheType finished:finished waitStoreCache:waitStoreCache completion:^{
|
|
608
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock image:image data:data error:nil cacheType:cacheType finished:finished url:url];
|
|
609
|
-
}];
|
|
610
|
-
});
|
|
611
|
-
} else {
|
|
612
|
-
// Store image and data
|
|
613
|
-
[self storeImage:image imageData:data forKey:key imageCache:imageCache cacheType:storeCacheType finished:finished waitStoreCache:waitStoreCache completion:^{
|
|
614
|
-
[self callCompletionBlockForOperation:operation completion:completedBlock image:image data:data error:nil cacheType:cacheType finished:finished url:url];
|
|
615
|
-
}];
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
#pragma mark - Helper
|
|
620
|
-
|
|
621
|
-
- (void)safelyRemoveOperationFromRunning:(nullable SDWebImageCombinedOperation*)operation {
|
|
622
|
-
if (!operation) {
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
SD_LOCK(_runningOperationsLock);
|
|
626
|
-
[self.runningOperations removeObject:operation];
|
|
627
|
-
SD_UNLOCK(_runningOperationsLock);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
- (void)storeImage:(nullable UIImage *)image
|
|
631
|
-
imageData:(nullable NSData *)data
|
|
632
|
-
forKey:(nullable NSString *)key
|
|
633
|
-
imageCache:(nonnull id<SDImageCache>)imageCache
|
|
634
|
-
cacheType:(SDImageCacheType)cacheType
|
|
635
|
-
finished:(BOOL)finished
|
|
636
|
-
waitStoreCache:(BOOL)waitStoreCache
|
|
637
|
-
completion:(nullable SDWebImageNoParamsBlock)completion {
|
|
638
|
-
// Ignore progressive data cache
|
|
639
|
-
if (!finished) {
|
|
640
|
-
if (completion) {
|
|
641
|
-
completion();
|
|
642
|
-
}
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
// Check whether we should wait the store cache finished. If not, callback immediately
|
|
646
|
-
[imageCache storeImage:image imageData:data forKey:key cacheType:cacheType completion:^{
|
|
647
|
-
if (waitStoreCache) {
|
|
648
|
-
if (completion) {
|
|
649
|
-
completion();
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
}];
|
|
653
|
-
if (!waitStoreCache) {
|
|
654
|
-
if (completion) {
|
|
655
|
-
completion();
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
- (void)callCompletionBlockForOperation:(nullable SDWebImageCombinedOperation*)operation
|
|
661
|
-
completion:(nullable SDInternalCompletionBlock)completionBlock
|
|
662
|
-
error:(nullable NSError *)error
|
|
663
|
-
url:(nullable NSURL *)url {
|
|
664
|
-
[self callCompletionBlockForOperation:operation completion:completionBlock image:nil data:nil error:error cacheType:SDImageCacheTypeNone finished:YES url:url];
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
- (void)callCompletionBlockForOperation:(nullable SDWebImageCombinedOperation*)operation
|
|
668
|
-
completion:(nullable SDInternalCompletionBlock)completionBlock
|
|
669
|
-
image:(nullable UIImage *)image
|
|
670
|
-
data:(nullable NSData *)data
|
|
671
|
-
error:(nullable NSError *)error
|
|
672
|
-
cacheType:(SDImageCacheType)cacheType
|
|
673
|
-
finished:(BOOL)finished
|
|
674
|
-
url:(nullable NSURL *)url {
|
|
675
|
-
if (completionBlock) {
|
|
676
|
-
dispatch_main_async_safe(^{
|
|
677
|
-
completionBlock(image, data, error, cacheType, finished, url);
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
- (BOOL)shouldBlockFailedURLWithURL:(nonnull NSURL *)url
|
|
683
|
-
error:(nonnull NSError *)error
|
|
684
|
-
options:(SDWebImageOptions)options
|
|
685
|
-
context:(nullable SDWebImageContext *)context {
|
|
686
|
-
id<SDImageLoader> imageLoader = context[SDWebImageContextImageLoader];
|
|
687
|
-
if (!imageLoader) {
|
|
688
|
-
imageLoader = self.imageLoader;
|
|
689
|
-
}
|
|
690
|
-
// Check whether we should block failed url
|
|
691
|
-
BOOL shouldBlockFailedURL;
|
|
692
|
-
if ([self.delegate respondsToSelector:@selector(imageManager:shouldBlockFailedURL:withError:)]) {
|
|
693
|
-
shouldBlockFailedURL = [self.delegate imageManager:self shouldBlockFailedURL:url withError:error];
|
|
694
|
-
} else {
|
|
695
|
-
if ([imageLoader respondsToSelector:@selector(shouldBlockFailedURLWithURL:error:options:context:)]) {
|
|
696
|
-
shouldBlockFailedURL = [imageLoader shouldBlockFailedURLWithURL:url error:error options:options context:context];
|
|
697
|
-
} else {
|
|
698
|
-
shouldBlockFailedURL = [imageLoader shouldBlockFailedURLWithURL:url error:error];
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
return shouldBlockFailedURL;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
- (SDWebImageOptionsResult *)processedResultForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context {
|
|
706
|
-
SDWebImageOptionsResult *result;
|
|
707
|
-
SDWebImageMutableContext *mutableContext = [SDWebImageMutableContext dictionary];
|
|
708
|
-
|
|
709
|
-
// Image Transformer from manager
|
|
710
|
-
if (!context[SDWebImageContextImageTransformer]) {
|
|
711
|
-
id<SDImageTransformer> transformer = self.transformer;
|
|
712
|
-
[mutableContext setValue:transformer forKey:SDWebImageContextImageTransformer];
|
|
713
|
-
}
|
|
714
|
-
// Cache key filter from manager
|
|
715
|
-
if (!context[SDWebImageContextCacheKeyFilter]) {
|
|
716
|
-
id<SDWebImageCacheKeyFilter> cacheKeyFilter = self.cacheKeyFilter;
|
|
717
|
-
[mutableContext setValue:cacheKeyFilter forKey:SDWebImageContextCacheKeyFilter];
|
|
718
|
-
}
|
|
719
|
-
// Cache serializer from manager
|
|
720
|
-
if (!context[SDWebImageContextCacheSerializer]) {
|
|
721
|
-
id<SDWebImageCacheSerializer> cacheSerializer = self.cacheSerializer;
|
|
722
|
-
[mutableContext setValue:cacheSerializer forKey:SDWebImageContextCacheSerializer];
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
if (mutableContext.count > 0) {
|
|
726
|
-
if (context) {
|
|
727
|
-
[mutableContext addEntriesFromDictionary:context];
|
|
728
|
-
}
|
|
729
|
-
context = [mutableContext copy];
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
// Apply options processor
|
|
733
|
-
if (self.optionsProcessor) {
|
|
734
|
-
result = [self.optionsProcessor processedResultForURL:url options:options context:context];
|
|
735
|
-
}
|
|
736
|
-
if (!result) {
|
|
737
|
-
// Use default options result
|
|
738
|
-
result = [[SDWebImageOptionsResult alloc] initWithOptions:options context:context];
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
return result;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
@end
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
@implementation SDWebImageCombinedOperation
|
|
748
|
-
|
|
749
|
-
- (BOOL)isCancelled {
|
|
750
|
-
// Need recursive lock (user's cancel block may check isCancelled), do not use SD_LOCK
|
|
751
|
-
@synchronized (self) {
|
|
752
|
-
return _cancelled;
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
- (void)cancel {
|
|
757
|
-
// Need recursive lock (user's cancel block may check isCancelled), do not use SD_LOCK
|
|
758
|
-
@synchronized(self) {
|
|
759
|
-
if (_cancelled) {
|
|
760
|
-
return;
|
|
761
|
-
}
|
|
762
|
-
_cancelled = YES;
|
|
763
|
-
if (self.cacheOperation) {
|
|
764
|
-
[self.cacheOperation cancel];
|
|
765
|
-
self.cacheOperation = nil;
|
|
766
|
-
}
|
|
767
|
-
if (self.loaderOperation) {
|
|
768
|
-
[self.loaderOperation cancel];
|
|
769
|
-
self.loaderOperation = nil;
|
|
770
|
-
}
|
|
771
|
-
[self.manager safelyRemoveOperationFromRunning:self];
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
@end
|