@momo-kits/native-kits 0.0.1-beta.4 → 0.0.1-beta.5
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/example/ios/Example/ComponentModel.swift +7 -2
- package/example/ios/Example/ContentView.swift +0 -14
- package/example/ios/Example/Foundation/ImageDemo.swift +43 -0
- package/example/ios/Example/Foundation/Popup/Popups.swift +2 -52
- package/example/ios/Example/Foundation/PopupDemo.swift +44 -21
- package/example/ios/Example/Foundation/TextInputDemo.swift +13 -8
- package/example/ios/Example/Library/CheckboxDemo.swift +19 -0
- package/example/ios/Example/Library/SwitchDemo.swift +19 -0
- package/example/ios/Example/Main.swift +17 -1
- package/example/ios/Example/Resource/foundation.json +2 -2
- package/example/ios/Example/Resource/library.json +10 -0
- package/example/ios/Example.xcodeproj/project.pbxproj +12 -1
- package/example/ios/Example.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +1 -1
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Podfile +2 -1
- package/example/ios/Podfile.lock +22 -3
- package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +8 -0
- package/example/ios/Pods/Manifest.lock +22 -3
- package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +1551 -165
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +21 -0
- package/example/ios/Pods/SDWebImage/LICENSE +20 -0
- package/example/ios/Pods/SDWebImage/README.md +352 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h +340 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m +172 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h +63 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m +165 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h +67 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m +120 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h +114 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m +392 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h +112 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m +420 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h +23 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m +133 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h +168 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m +79 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h +110 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m +540 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h +145 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m +326 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h +73 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m +256 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h +19 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m +58 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h +23 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m +98 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h +450 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m +1030 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h +153 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m +68 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h +156 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m +138 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h +81 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m +556 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h +297 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m +26 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h +153 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m +822 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h +58 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m +130 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h +36 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m +28 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h +22 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m +58 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h +28 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m +127 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h +25 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m +101 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h +58 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m +807 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h +30 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m +420 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h +146 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m +170 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h +40 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m +123 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h +241 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m +331 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h +78 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m +158 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h +32 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m +39 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h +36 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m +39 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h +95 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m +17 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h +352 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m +149 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h +314 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m +658 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h +113 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m +60 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h +49 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m +55 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h +191 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m +722 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h +69 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m +71 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h +69 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m +73 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h +32 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m +16 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h +115 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m +275 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h +290 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m +775 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h +27 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m +14 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h +72 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m +59 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h +143 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m +303 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h +131 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m +194 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h +387 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m +234 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h +24 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m +23 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h +46 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m +60 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h +26 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m +22 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h +27 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m +47 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h +89 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m +221 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h +80 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m +47 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h +146 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m +824 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h +129 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m +76 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h +194 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m +67 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h +110 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m +446 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h +48 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m +82 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h +24 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m +42 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h +14 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m +29 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h +21 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m +92 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h +18 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m +32 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h +29 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m +227 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h +19 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m +127 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h +23 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m +164 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h +21 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m +83 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h +39 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h +122 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m +13 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h +20 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m +79 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h +19 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h +667 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h +18 -0
- package/example/ios/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m +42 -0
- package/example/ios/Pods/SDWebImage/WebImage/SDWebImage.h +89 -0
- package/example/ios/Pods/SDWebImageSwiftUI/LICENSE +19 -0
- package/example/ios/Pods/SDWebImageSwiftUI/README.md +690 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/AnimatedImage.swift +870 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/Backport.swift +59 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/OnChange.swift +52 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/Overlay.swift +124 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Backports/StateObject.swift +151 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Image.swift +78 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageManager.swift +132 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImagePlayer.swift +122 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageViewWrapper.swift +133 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ActivityIndicator.swift +82 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/Indicator.swift +97 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ProgressIndicator.swift +114 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SDWebImageSwiftUI.swift +64 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SwiftUICompatibility.swift +92 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Transition/Transition.swift +93 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/WebImage.swift +509 -0
- package/example/ios/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Module/SDWebImageSwiftUI.h +15 -0
- package/example/ios/Pods/SkeletonUI/LICENSE +21 -0
- package/example/ios/Pods/SkeletonUI/README.md +137 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Angle/AngleInteractor.swift +29 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Angle/AnglePresenter.swift +7 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Animation/AnimationInteractor.swift +56 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Appearance/AppearanceInteractor.swift +58 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Appearance/AppearancePresenter.swift +5 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/ClosedRange+Normalize.swift +16 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Image+OptionalType.swift +102 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/ModifiedContent+SkeletonModifier.swift +26 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Optional+OptionalType.swift +5 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/SecureField+OptionalType.swift +19 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Text+OptionalType.swift +27 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/TextField+OptionalType.swift +35 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/Toggle+OptionalType.swift +29 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/UnitPoint+Angle.swift +8 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Extensions/View+SkeletonModifier.swift +8 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Modifiers/SkeletonModifier.swift +52 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Multiline/MultilineInteractor.swift +41 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Multiline/MultilinePresenter.swift +9 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Opacity/OpacityInteractor.swift +29 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Opacity/OpacityPresenter.swift +7 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Position/PositionInteractor.swift +29 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Position/PositionPresenter.swift +7 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Protocols/OptionalType.swift +4 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Radius/RadiusInteractor.swift +29 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Radius/RadiusPresenter.swift +7 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Shape/ShapeInteractor.swift +33 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Shape/ShapePresenter.swift +5 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonForEach.swift +20 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonInteractor.swift +27 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonList.swift +20 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonPresenter.swift +15 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonShape.swift +64 -0
- package/example/ios/Pods/SkeletonUI/Sources/SkeletonUI/Skeleton/SkeletonView.swift +25 -0
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +4 -1
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +4 -1
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +72 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +90 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +6 -5
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +6 -5
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m +5 -0
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch +12 -0
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h +75 -0
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig +14 -0
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap +6 -0
- package/example/ios/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig +14 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-dummy.m +5 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-prefix.pch +12 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-umbrella.h +17 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.debug.xcconfig +17 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.modulemap +6 -0
- package/example/ios/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.release.xcconfig +17 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-dummy.m +5 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-prefix.pch +12 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI-umbrella.h +16 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.debug.xcconfig +12 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.modulemap +6 -0
- package/example/ios/Pods/Target Support Files/SkeletonUI/SkeletonUI.release.xcconfig +12 -0
- package/ios/Checkbox/Checkbox.swift +38 -0
- package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Colors.swift +0 -0
- package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
- package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Spacing.swift +0 -0
- package/ios/Extensions/View++.swift +9 -0
- package/ios/Image/Image.swift +60 -0
- package/ios/Input/Input.swift +88 -38
- package/ios/OTPKeyboard/OTPKeyboard.swift +1 -1
- package/ios/Popup/PopupDisplay.swift +178 -0
- package/ios/PopupView/FullscreenPopup.swift +251 -0
- package/ios/{Popup → PopupView}/Modifiers.swift +6 -20
- package/ios/{Popup → PopupView}/PopupView.swift +38 -146
- package/ios/PopupView/Utils++.swift +281 -0
- package/ios/Switch/Switch.swift +44 -0
- package/ios/native-kits.podspec +2 -0
- package/package.json +1 -1
- package/ios/Colors+Spacing/Radius.swift +0 -11
- package/ios/Popup/Utils++.swift +0 -163
|
@@ -0,0 +1,420 @@
|
|
|
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 "SDAnimatedImagePlayer.h"
|
|
10
|
+
#import "NSImage+Compatibility.h"
|
|
11
|
+
#import "SDDisplayLink.h"
|
|
12
|
+
#import "SDDeviceHelper.h"
|
|
13
|
+
#import "SDInternalMacros.h"
|
|
14
|
+
|
|
15
|
+
@interface SDAnimatedImagePlayer () {
|
|
16
|
+
SD_LOCK_DECLARE(_lock);
|
|
17
|
+
NSRunLoopMode _runLoopMode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@property (nonatomic, strong, readwrite) UIImage *currentFrame;
|
|
21
|
+
@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex;
|
|
22
|
+
@property (nonatomic, assign, readwrite) NSUInteger currentLoopCount;
|
|
23
|
+
@property (nonatomic, strong) id<SDAnimatedImageProvider> animatedProvider;
|
|
24
|
+
@property (nonatomic, strong) NSMutableDictionary<NSNumber *, UIImage *> *frameBuffer;
|
|
25
|
+
@property (nonatomic, assign) NSTimeInterval currentTime;
|
|
26
|
+
@property (nonatomic, assign) BOOL bufferMiss;
|
|
27
|
+
@property (nonatomic, assign) BOOL needsDisplayWhenImageBecomesAvailable;
|
|
28
|
+
@property (nonatomic, assign) BOOL shouldReverse;
|
|
29
|
+
@property (nonatomic, assign) NSUInteger maxBufferCount;
|
|
30
|
+
@property (nonatomic, strong) NSOperationQueue *fetchQueue;
|
|
31
|
+
@property (nonatomic, strong) SDDisplayLink *displayLink;
|
|
32
|
+
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
@implementation SDAnimatedImagePlayer
|
|
36
|
+
|
|
37
|
+
- (instancetype)initWithProvider:(id<SDAnimatedImageProvider>)provider {
|
|
38
|
+
self = [super init];
|
|
39
|
+
if (self) {
|
|
40
|
+
NSUInteger animatedImageFrameCount = provider.animatedImageFrameCount;
|
|
41
|
+
// Check the frame count
|
|
42
|
+
if (animatedImageFrameCount <= 1) {
|
|
43
|
+
return nil;
|
|
44
|
+
}
|
|
45
|
+
self.totalFrameCount = animatedImageFrameCount;
|
|
46
|
+
// Get the current frame and loop count.
|
|
47
|
+
self.totalLoopCount = provider.animatedImageLoopCount;
|
|
48
|
+
self.animatedProvider = provider;
|
|
49
|
+
self.playbackRate = 1.0;
|
|
50
|
+
SD_LOCK_INIT(_lock);
|
|
51
|
+
#if SD_UIKIT
|
|
52
|
+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
|
|
53
|
+
#endif
|
|
54
|
+
}
|
|
55
|
+
return self;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
+ (instancetype)playerWithProvider:(id<SDAnimatedImageProvider>)provider {
|
|
59
|
+
SDAnimatedImagePlayer *player = [[SDAnimatedImagePlayer alloc] initWithProvider:provider];
|
|
60
|
+
return player;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#pragma mark - Life Cycle
|
|
64
|
+
|
|
65
|
+
- (void)dealloc {
|
|
66
|
+
#if SD_UIKIT
|
|
67
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
|
|
68
|
+
#endif
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
- (void)didReceiveMemoryWarning:(NSNotification *)notification {
|
|
72
|
+
[_fetchQueue cancelAllOperations];
|
|
73
|
+
NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
|
|
74
|
+
NSNumber *currentFrameIndex = @(self.currentFrameIndex);
|
|
75
|
+
SD_LOCK(self->_lock);
|
|
76
|
+
NSArray *keys = self.frameBuffer.allKeys;
|
|
77
|
+
// only keep the next frame for later rendering
|
|
78
|
+
for (NSNumber * key in keys) {
|
|
79
|
+
if (![key isEqualToNumber:currentFrameIndex]) {
|
|
80
|
+
[self.frameBuffer removeObjectForKey:key];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
SD_UNLOCK(self->_lock);
|
|
84
|
+
}];
|
|
85
|
+
[_fetchQueue addOperation:operation];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#pragma mark - Private
|
|
89
|
+
- (NSOperationQueue *)fetchQueue {
|
|
90
|
+
if (!_fetchQueue) {
|
|
91
|
+
_fetchQueue = [[NSOperationQueue alloc] init];
|
|
92
|
+
_fetchQueue.maxConcurrentOperationCount = 1;
|
|
93
|
+
}
|
|
94
|
+
return _fetchQueue;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
- (NSMutableDictionary<NSNumber *,UIImage *> *)frameBuffer {
|
|
98
|
+
if (!_frameBuffer) {
|
|
99
|
+
_frameBuffer = [NSMutableDictionary dictionary];
|
|
100
|
+
}
|
|
101
|
+
return _frameBuffer;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
- (SDDisplayLink *)displayLink {
|
|
105
|
+
if (!_displayLink) {
|
|
106
|
+
_displayLink = [SDDisplayLink displayLinkWithTarget:self selector:@selector(displayDidRefresh:)];
|
|
107
|
+
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.runLoopMode];
|
|
108
|
+
[_displayLink stop];
|
|
109
|
+
}
|
|
110
|
+
return _displayLink;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
- (void)setRunLoopMode:(NSRunLoopMode)runLoopMode {
|
|
114
|
+
if ([_runLoopMode isEqual:runLoopMode]) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (_displayLink) {
|
|
118
|
+
if (_runLoopMode) {
|
|
119
|
+
[_displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:_runLoopMode];
|
|
120
|
+
}
|
|
121
|
+
if (runLoopMode.length > 0) {
|
|
122
|
+
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:runLoopMode];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
_runLoopMode = [runLoopMode copy];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
- (NSRunLoopMode)runLoopMode {
|
|
129
|
+
if (!_runLoopMode) {
|
|
130
|
+
_runLoopMode = [[self class] defaultRunLoopMode];
|
|
131
|
+
}
|
|
132
|
+
return _runLoopMode;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
#pragma mark - State Control
|
|
136
|
+
|
|
137
|
+
- (void)setupCurrentFrame {
|
|
138
|
+
if (self.currentFrameIndex != 0) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (self.playbackMode == SDAnimatedImagePlaybackModeReverse ||
|
|
142
|
+
self.playbackMode == SDAnimatedImagePlaybackModeReversedBounce) {
|
|
143
|
+
self.currentFrameIndex = self.totalFrameCount - 1;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (!self.currentFrame && [self.animatedProvider isKindOfClass:[UIImage class]]) {
|
|
147
|
+
UIImage *image = (UIImage *)self.animatedProvider;
|
|
148
|
+
// Cache the poster image if available, but should not callback to avoid caller thread issues
|
|
149
|
+
#if SD_MAC
|
|
150
|
+
UIImage *posterFrame = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];
|
|
151
|
+
#else
|
|
152
|
+
UIImage *posterFrame = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation];
|
|
153
|
+
#endif
|
|
154
|
+
if (posterFrame) {
|
|
155
|
+
// HACK: The first frame should not check duration and immediately display
|
|
156
|
+
self.needsDisplayWhenImageBecomesAvailable = YES;
|
|
157
|
+
SD_LOCK(self->_lock);
|
|
158
|
+
self.frameBuffer[@(self.currentFrameIndex)] = posterFrame;
|
|
159
|
+
SD_UNLOCK(self->_lock);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
- (void)resetCurrentFrameStatus {
|
|
166
|
+
// These should not trigger KVO, user don't need to receive an `index == 0, image == nil` callback.
|
|
167
|
+
_currentFrame = nil;
|
|
168
|
+
_currentFrameIndex = 0;
|
|
169
|
+
_currentLoopCount = 0;
|
|
170
|
+
_currentTime = 0;
|
|
171
|
+
_bufferMiss = NO;
|
|
172
|
+
_needsDisplayWhenImageBecomesAvailable = NO;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
- (void)clearFrameBuffer {
|
|
176
|
+
SD_LOCK(_lock);
|
|
177
|
+
[_frameBuffer removeAllObjects];
|
|
178
|
+
SD_UNLOCK(_lock);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
#pragma mark - Animation Control
|
|
182
|
+
- (void)startPlaying {
|
|
183
|
+
[self.displayLink start];
|
|
184
|
+
// Setup frame
|
|
185
|
+
[self setupCurrentFrame];
|
|
186
|
+
// Calculate max buffer size
|
|
187
|
+
[self calculateMaxBufferCount];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
- (void)stopPlaying {
|
|
191
|
+
[_fetchQueue cancelAllOperations];
|
|
192
|
+
// Using `_displayLink` here because when UIImageView dealloc, it may trigger `[self stopAnimating]`, we already release the display link in SDAnimatedImageView's dealloc method.
|
|
193
|
+
[_displayLink stop];
|
|
194
|
+
// We need to reset the frame status, but not trigger any handle. This can ensure next time's playing status correct.
|
|
195
|
+
[self resetCurrentFrameStatus];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
- (void)pausePlaying {
|
|
199
|
+
[_fetchQueue cancelAllOperations];
|
|
200
|
+
[_displayLink stop];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
- (BOOL)isPlaying {
|
|
204
|
+
return _displayLink.isRunning;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
- (void)seekToFrameAtIndex:(NSUInteger)index loopCount:(NSUInteger)loopCount {
|
|
208
|
+
if (index >= self.totalFrameCount) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
self.currentFrameIndex = index;
|
|
212
|
+
self.currentLoopCount = loopCount;
|
|
213
|
+
self.currentFrame = [self.animatedProvider animatedImageFrameAtIndex:index];
|
|
214
|
+
[self handleFrameChange];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
#pragma mark - Core Render
|
|
218
|
+
- (void)displayDidRefresh:(SDDisplayLink *)displayLink {
|
|
219
|
+
// If for some reason a wild call makes it through when we shouldn't be animating, bail.
|
|
220
|
+
// Early return!
|
|
221
|
+
if (!self.isPlaying) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
NSUInteger totalFrameCount = self.totalFrameCount;
|
|
226
|
+
if (totalFrameCount <= 1) {
|
|
227
|
+
// Total frame count less than 1, wrong configuration and stop animating
|
|
228
|
+
[self stopPlaying];
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
NSTimeInterval playbackRate = self.playbackRate;
|
|
233
|
+
if (playbackRate <= 0) {
|
|
234
|
+
// Does not support <= 0 play rate
|
|
235
|
+
[self stopPlaying];
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Calculate refresh duration
|
|
240
|
+
NSTimeInterval duration = self.displayLink.duration;
|
|
241
|
+
|
|
242
|
+
NSUInteger currentFrameIndex = self.currentFrameIndex;
|
|
243
|
+
NSUInteger nextFrameIndex = (currentFrameIndex + 1) % totalFrameCount;
|
|
244
|
+
|
|
245
|
+
if (self.playbackMode == SDAnimatedImagePlaybackModeReverse) {
|
|
246
|
+
nextFrameIndex = currentFrameIndex == 0 ? (totalFrameCount - 1) : (currentFrameIndex - 1) % totalFrameCount;
|
|
247
|
+
|
|
248
|
+
} else if (self.playbackMode == SDAnimatedImagePlaybackModeBounce ||
|
|
249
|
+
self.playbackMode == SDAnimatedImagePlaybackModeReversedBounce) {
|
|
250
|
+
if (currentFrameIndex == 0) {
|
|
251
|
+
self.shouldReverse = false;
|
|
252
|
+
} else if (currentFrameIndex == totalFrameCount - 1) {
|
|
253
|
+
self.shouldReverse = true;
|
|
254
|
+
}
|
|
255
|
+
nextFrameIndex = self.shouldReverse ? (currentFrameIndex - 1) : (currentFrameIndex + 1);
|
|
256
|
+
nextFrameIndex %= totalFrameCount;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
// Check if we need to display new frame firstly
|
|
261
|
+
BOOL bufferFull = NO;
|
|
262
|
+
if (self.needsDisplayWhenImageBecomesAvailable) {
|
|
263
|
+
UIImage *currentFrame;
|
|
264
|
+
SD_LOCK(_lock);
|
|
265
|
+
currentFrame = self.frameBuffer[@(currentFrameIndex)];
|
|
266
|
+
SD_UNLOCK(_lock);
|
|
267
|
+
|
|
268
|
+
// Update the current frame
|
|
269
|
+
if (currentFrame) {
|
|
270
|
+
SD_LOCK(_lock);
|
|
271
|
+
// Remove the frame buffer if need
|
|
272
|
+
if (self.frameBuffer.count > self.maxBufferCount) {
|
|
273
|
+
self.frameBuffer[@(currentFrameIndex)] = nil;
|
|
274
|
+
}
|
|
275
|
+
// Check whether we can stop fetch
|
|
276
|
+
if (self.frameBuffer.count == totalFrameCount) {
|
|
277
|
+
bufferFull = YES;
|
|
278
|
+
}
|
|
279
|
+
SD_UNLOCK(_lock);
|
|
280
|
+
|
|
281
|
+
// Update the current frame immediately
|
|
282
|
+
self.currentFrame = currentFrame;
|
|
283
|
+
[self handleFrameChange];
|
|
284
|
+
|
|
285
|
+
self.bufferMiss = NO;
|
|
286
|
+
self.needsDisplayWhenImageBecomesAvailable = NO;
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
self.bufferMiss = YES;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Check if we have the frame buffer
|
|
294
|
+
if (!self.bufferMiss) {
|
|
295
|
+
// Then check if timestamp is reached
|
|
296
|
+
self.currentTime += duration;
|
|
297
|
+
NSTimeInterval currentDuration = [self.animatedProvider animatedImageDurationAtIndex:currentFrameIndex];
|
|
298
|
+
currentDuration = currentDuration / playbackRate;
|
|
299
|
+
if (self.currentTime < currentDuration) {
|
|
300
|
+
// Current frame timestamp not reached, prefetch frame in advance.
|
|
301
|
+
[self prefetchFrameAtIndex:currentFrameIndex
|
|
302
|
+
nextIndex:nextFrameIndex
|
|
303
|
+
bufferFull:bufferFull];
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Otherwise, we should be ready to display next frame
|
|
308
|
+
self.needsDisplayWhenImageBecomesAvailable = YES;
|
|
309
|
+
self.currentFrameIndex = nextFrameIndex;
|
|
310
|
+
self.currentTime -= currentDuration;
|
|
311
|
+
NSTimeInterval nextDuration = [self.animatedProvider animatedImageDurationAtIndex:nextFrameIndex];
|
|
312
|
+
nextDuration = nextDuration / playbackRate;
|
|
313
|
+
if (self.currentTime > nextDuration) {
|
|
314
|
+
// Do not skip frame
|
|
315
|
+
self.currentTime = nextDuration;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Update the loop count when last frame rendered
|
|
319
|
+
if (nextFrameIndex == 0) {
|
|
320
|
+
// Update the loop count
|
|
321
|
+
self.currentLoopCount++;
|
|
322
|
+
[self handleLoopChange];
|
|
323
|
+
|
|
324
|
+
// if reached the max loop count, stop animating, 0 means loop indefinitely
|
|
325
|
+
NSUInteger maxLoopCount = self.totalLoopCount;
|
|
326
|
+
if (maxLoopCount != 0 && (self.currentLoopCount >= maxLoopCount)) {
|
|
327
|
+
[self stopPlaying];
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Since we support handler, check animating state again
|
|
334
|
+
if (!self.isPlaying) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
[self prefetchFrameAtIndex:currentFrameIndex
|
|
339
|
+
nextIndex:nextFrameIndex
|
|
340
|
+
bufferFull:bufferFull];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Check if we should prefetch next frame or current frame
|
|
344
|
+
// When buffer miss, means the decode speed is slower than render speed, we fetch current miss frame
|
|
345
|
+
// Or, most cases, the decode speed is faster than render speed, we fetch next frame
|
|
346
|
+
- (void)prefetchFrameAtIndex:(NSUInteger)currentIndex
|
|
347
|
+
nextIndex:(NSUInteger)nextIndex
|
|
348
|
+
bufferFull:(BOOL)bufferFull {
|
|
349
|
+
NSUInteger fetchFrameIndex = currentIndex;
|
|
350
|
+
UIImage *fetchFrame = nil;
|
|
351
|
+
if (!self.bufferMiss) {
|
|
352
|
+
fetchFrameIndex = nextIndex;
|
|
353
|
+
SD_LOCK(_lock);
|
|
354
|
+
fetchFrame = self.frameBuffer[@(nextIndex)];
|
|
355
|
+
SD_UNLOCK(_lock);
|
|
356
|
+
}
|
|
357
|
+
if (!fetchFrame && !bufferFull && self.fetchQueue.operationCount == 0) {
|
|
358
|
+
// Prefetch next frame in background queue
|
|
359
|
+
id<SDAnimatedImageProvider> animatedProvider = self.animatedProvider;
|
|
360
|
+
@weakify(self);
|
|
361
|
+
NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
|
|
362
|
+
@strongify(self);
|
|
363
|
+
if (!self) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
UIImage *frame = [animatedProvider animatedImageFrameAtIndex:fetchFrameIndex];
|
|
367
|
+
|
|
368
|
+
BOOL isAnimating = self.displayLink.isRunning;
|
|
369
|
+
if (isAnimating) {
|
|
370
|
+
SD_LOCK(self->_lock);
|
|
371
|
+
self.frameBuffer[@(fetchFrameIndex)] = frame;
|
|
372
|
+
SD_UNLOCK(self->_lock);
|
|
373
|
+
}
|
|
374
|
+
}];
|
|
375
|
+
[self.fetchQueue addOperation:operation];
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
- (void)handleFrameChange {
|
|
380
|
+
if (self.animationFrameHandler) {
|
|
381
|
+
self.animationFrameHandler(self.currentFrameIndex, self.currentFrame);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
- (void)handleLoopChange {
|
|
386
|
+
if (self.animationLoopHandler) {
|
|
387
|
+
self.animationLoopHandler(self.currentLoopCount);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
#pragma mark - Util
|
|
392
|
+
- (void)calculateMaxBufferCount {
|
|
393
|
+
NSUInteger bytes = CGImageGetBytesPerRow(self.currentFrame.CGImage) * CGImageGetHeight(self.currentFrame.CGImage);
|
|
394
|
+
if (bytes == 0) bytes = 1024;
|
|
395
|
+
|
|
396
|
+
NSUInteger max = 0;
|
|
397
|
+
if (self.maxBufferSize > 0) {
|
|
398
|
+
max = self.maxBufferSize;
|
|
399
|
+
} else {
|
|
400
|
+
// Calculate based on current memory, these factors are by experience
|
|
401
|
+
NSUInteger total = [SDDeviceHelper totalMemory];
|
|
402
|
+
NSUInteger free = [SDDeviceHelper freeMemory];
|
|
403
|
+
max = MIN(total * 0.2, free * 0.6);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
NSUInteger maxBufferCount = (double)max / (double)bytes;
|
|
407
|
+
if (!maxBufferCount) {
|
|
408
|
+
// At least 1 frame
|
|
409
|
+
maxBufferCount = 1;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
self.maxBufferCount = maxBufferCount;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
+ (NSString *)defaultRunLoopMode {
|
|
416
|
+
// Key off `activeProcessorCount` (as opposed to `processorCount`) since the system could shut down cores in certain situations.
|
|
417
|
+
return [NSProcessInfo processInfo].activeProcessorCount > 1 ? NSRunLoopCommonModes : NSDefaultRunLoopMode;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
@end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the SDWebImage package.
|
|
3
|
+
* (c) Olivier Poitrey <rs@dailymotion.com>
|
|
4
|
+
*
|
|
5
|
+
* For the full copyright and license information, please view the LICENSE
|
|
6
|
+
* file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#import "SDWebImageCompat.h"
|
|
10
|
+
|
|
11
|
+
#if SD_MAC
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
A subclass of `NSBitmapImageRep` to fix that GIF duration issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`.
|
|
15
|
+
This also fix the GIF loop count issue, which will use the Netscape standard (See http://www6.uniovi.es/gifanim/gifabout.htm) to only place once when the `kCGImagePropertyGIFLoopCount` is nil. This is what modern browser's behavior.
|
|
16
|
+
Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image.
|
|
17
|
+
This also support APNG format using `SDImageAPNGCoder`. Which provide full alpha-channel support and the correct duration match the `kCGImagePropertyAPNGUnclampedDelayTime`.
|
|
18
|
+
*/
|
|
19
|
+
@interface SDAnimatedImageRep : NSBitmapImageRep
|
|
20
|
+
|
|
21
|
+
@end
|
|
22
|
+
|
|
23
|
+
#endif
|
|
@@ -0,0 +1,133 @@
|
|
|
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 "SDAnimatedImageRep.h"
|
|
10
|
+
|
|
11
|
+
#if SD_MAC
|
|
12
|
+
|
|
13
|
+
#import "SDImageIOAnimatedCoderInternal.h"
|
|
14
|
+
#import "SDImageGIFCoder.h"
|
|
15
|
+
#import "SDImageAPNGCoder.h"
|
|
16
|
+
#import "SDImageHEICCoder.h"
|
|
17
|
+
#import "SDImageAWebPCoder.h"
|
|
18
|
+
|
|
19
|
+
@implementation SDAnimatedImageRep {
|
|
20
|
+
CGImageSourceRef _imageSource;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
- (void)dealloc {
|
|
24
|
+
if (_imageSource) {
|
|
25
|
+
CFRelease(_imageSource);
|
|
26
|
+
_imageSource = NULL;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (instancetype)copyWithZone:(NSZone *)zone {
|
|
31
|
+
SDAnimatedImageRep *imageRep = [super copyWithZone:zone];
|
|
32
|
+
CFRetain(imageRep->_imageSource);
|
|
33
|
+
return imageRep;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// `NSBitmapImageRep`'s `imageRepWithData:` is not designed initializer
|
|
37
|
+
+ (instancetype)imageRepWithData:(NSData *)data {
|
|
38
|
+
SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data];
|
|
39
|
+
return imageRep;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// We should override init method for `NSBitmapImageRep` to do initialize about animated image format
|
|
43
|
+
#pragma clang diagnostic push
|
|
44
|
+
#pragma clang diagnostic ignored "-Wunguarded-availability"
|
|
45
|
+
- (instancetype)initWithData:(NSData *)data {
|
|
46
|
+
self = [super initWithData:data];
|
|
47
|
+
if (self) {
|
|
48
|
+
CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef) data, NULL);
|
|
49
|
+
if (!imageSource) {
|
|
50
|
+
return self;
|
|
51
|
+
}
|
|
52
|
+
_imageSource = imageSource;
|
|
53
|
+
NSUInteger frameCount = CGImageSourceGetCount(imageSource);
|
|
54
|
+
if (frameCount <= 1) {
|
|
55
|
+
return self;
|
|
56
|
+
}
|
|
57
|
+
CFStringRef type = CGImageSourceGetType(imageSource);
|
|
58
|
+
if (!type) {
|
|
59
|
+
return self;
|
|
60
|
+
}
|
|
61
|
+
if (CFStringCompare(type, kSDUTTypeGIF, 0) == kCFCompareEqualTo) {
|
|
62
|
+
// GIF
|
|
63
|
+
// Fix the `NSBitmapImageRep` GIF loop count calculation issue
|
|
64
|
+
// Which will use 0 when there are no loop count information metadata in GIF data
|
|
65
|
+
NSUInteger loopCount = [SDImageGIFCoder imageLoopCountWithSource:imageSource];
|
|
66
|
+
[self setProperty:NSImageLoopCount withValue:@(loopCount)];
|
|
67
|
+
} else if (CFStringCompare(type, kSDUTTypePNG, 0) == kCFCompareEqualTo) {
|
|
68
|
+
// APNG
|
|
69
|
+
// Do initialize about frame count, current frame/duration and loop count
|
|
70
|
+
[self setProperty:NSImageFrameCount withValue:@(frameCount)];
|
|
71
|
+
[self setProperty:NSImageCurrentFrame withValue:@(0)];
|
|
72
|
+
NSUInteger loopCount = [SDImageAPNGCoder imageLoopCountWithSource:imageSource];
|
|
73
|
+
[self setProperty:NSImageLoopCount withValue:@(loopCount)];
|
|
74
|
+
} else if (CFStringCompare(type, kSDUTTypeHEICS, 0) == kCFCompareEqualTo) {
|
|
75
|
+
// HEIC
|
|
76
|
+
// Do initialize about frame count, current frame/duration and loop count
|
|
77
|
+
[self setProperty:NSImageFrameCount withValue:@(frameCount)];
|
|
78
|
+
[self setProperty:NSImageCurrentFrame withValue:@(0)];
|
|
79
|
+
NSUInteger loopCount = [SDImageHEICCoder imageLoopCountWithSource:imageSource];
|
|
80
|
+
[self setProperty:NSImageLoopCount withValue:@(loopCount)];
|
|
81
|
+
} else if (CFStringCompare(type, kSDUTTypeWebP, 0) == kCFCompareEqualTo) {
|
|
82
|
+
// WebP
|
|
83
|
+
// Do initialize about frame count, current frame/duration and loop count
|
|
84
|
+
[self setProperty:NSImageFrameCount withValue:@(frameCount)];
|
|
85
|
+
[self setProperty:NSImageCurrentFrame withValue:@(0)];
|
|
86
|
+
NSUInteger loopCount = [SDImageAWebPCoder imageLoopCountWithSource:imageSource];
|
|
87
|
+
[self setProperty:NSImageLoopCount withValue:@(loopCount)];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return self;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// `NSBitmapImageRep` will use `kCGImagePropertyGIFDelayTime` whenever you call `setProperty:withValue:` with `NSImageCurrentFrame` to change the current frame. We override it and use the actual `kCGImagePropertyGIFUnclampedDelayTime` if need.
|
|
94
|
+
- (void)setProperty:(NSBitmapImageRepPropertyKey)property withValue:(id)value {
|
|
95
|
+
[super setProperty:property withValue:value];
|
|
96
|
+
if ([property isEqualToString:NSImageCurrentFrame]) {
|
|
97
|
+
// Access the image source
|
|
98
|
+
CGImageSourceRef imageSource = _imageSource;
|
|
99
|
+
if (!imageSource) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
// Check format type
|
|
103
|
+
CFStringRef type = CGImageSourceGetType(imageSource);
|
|
104
|
+
if (!type) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
NSUInteger index = [value unsignedIntegerValue];
|
|
108
|
+
NSTimeInterval frameDuration = 0;
|
|
109
|
+
if (CFStringCompare(type, kSDUTTypeGIF, 0) == kCFCompareEqualTo) {
|
|
110
|
+
// GIF
|
|
111
|
+
frameDuration = [SDImageGIFCoder frameDurationAtIndex:index source:imageSource];
|
|
112
|
+
} else if (CFStringCompare(type, kSDUTTypePNG, 0) == kCFCompareEqualTo) {
|
|
113
|
+
// APNG
|
|
114
|
+
frameDuration = [SDImageAPNGCoder frameDurationAtIndex:index source:imageSource];
|
|
115
|
+
} else if (CFStringCompare(type, kSDUTTypeHEICS, 0) == kCFCompareEqualTo) {
|
|
116
|
+
// HEIC
|
|
117
|
+
frameDuration = [SDImageHEICCoder frameDurationAtIndex:index source:imageSource];
|
|
118
|
+
} else if (CFStringCompare(type, kSDUTTypeWebP, 0) == kCFCompareEqualTo) {
|
|
119
|
+
// WebP
|
|
120
|
+
frameDuration = [SDImageAWebPCoder frameDurationAtIndex:index source:imageSource];
|
|
121
|
+
}
|
|
122
|
+
if (!frameDuration) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
// Reset super frame duration with the actual frame duration
|
|
126
|
+
[super setProperty:NSImageCurrentFrameDuration withValue:@(frameDuration)];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
#pragma clang diagnostic pop
|
|
130
|
+
|
|
131
|
+
@end
|
|
132
|
+
|
|
133
|
+
#endif
|