From 8a216e2079b5333748ad26c3b8055ce3c57cd979 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 23 Apr 2019 11:54:46 +0800 Subject: [PATCH] feat: Upgrade to SDWebImage 5.0. (#454) This uses SDAnimatedImageView instead of FLAnimatedImageView for better animation support. BREAKING CHANGE: Upgrade SDWebImage, may affect some projects and CocoaPods users. Fix the bug of `cacheOnly` behavior fix #447 --- ios/FastImage.xcodeproj/project.pbxproj | 82 ++++--------------- ios/FastImage/FFFastImageView.h | 12 +-- ios/FastImage/FFFastImageView.m | 2 +- ios/Vendor/SDWebImage | 2 +- .../ReactNativeFastImageExample/Info.plist | 34 ++++---- react-native-fast-image.podspec | 5 +- 6 files changed, 41 insertions(+), 96 deletions(-) diff --git a/ios/FastImage.xcodeproj/project.pbxproj b/ios/FastImage.xcodeproj/project.pbxproj index d1f7d89c6..b711c7a9d 100644 --- a/ios/FastImage.xcodeproj/project.pbxproj +++ b/ios/FastImage.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - FCC6D1391EB3912D0065F944 /* libSDWebImage iOS static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FCC6D0D01EB38D2F0065F944 /* libSDWebImage iOS static.a */; }; + FCC6D1391EB3912D0065F944 /* libSDWebImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FCC6D0D01EB38D2F0065F944 /* libSDWebImage.a */; }; FCFB253F1EA5562700F59778 /* FFFastImageSource.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFB25381EA5562700F59778 /* FFFastImageSource.m */; }; FCFB25401EA5562700F59778 /* FFFastImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFB253A1EA5562700F59778 /* FFFastImageView.m */; }; FCFB25411EA5562700F59778 /* FFFastImageViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFB253C1EA5562700F59778 /* FFFastImageViewManager.m */; }; @@ -15,19 +15,19 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - FCC6D0CF1EB38D2F0065F944 /* PBXContainerItemProxy */ = { + 3236AC0D226EC00400425AA3 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */; proxyType = 2; - remoteGlobalIDString = 53761325155AD0D5005750A4; - remoteInfo = "SDWebImage iOS static"; + remoteGlobalIDString = 80B6DFEE2142B71600BCB334; + remoteInfo = SDWebImageMapKit; }; - FCC6D0D11EB38D2F0065F944 /* PBXContainerItemProxy */ = { + FCC6D0CF1EB38D2F0065F944 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */; proxyType = 2; - remoteGlobalIDString = 4314D1991D0E0E3B004B36C9; - remoteInfo = "SDWebImage watchOS static"; + remoteGlobalIDString = 53761325155AD0D5005750A4; + remoteInfo = "SDWebImage iOS static"; }; FCC6D0D31EB38D2F0065F944 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -36,27 +36,6 @@ remoteGlobalIDString = 4A2CADFF1AB4BB5300B6BC39; remoteInfo = "SDWebImage iOS"; }; - FCC6D0D51EB38D2F0065F944 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 00733A4C1BC487C000A5A117; - remoteInfo = "SDWebImage tvOS"; - }; - FCC6D0D71EB38D2F0065F944 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 431BB7031D06D2C1006A3455; - remoteInfo = "SDWebImage watchOS"; - }; - FCC6D0D91EB38D2F0065F944 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 4397D2F21D0DDD8C00BB2784; - remoteInfo = "SDWebImage OSX"; - }; FCC6D1281EB3908E0065F944 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */; @@ -96,7 +75,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FCC6D1391EB3912D0065F944 /* libSDWebImage iOS static.a in Frameworks */, + FCC6D1391EB3912D0065F944 /* libSDWebImage.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -131,12 +110,9 @@ FCC6D0C71EB38D2F0065F944 /* Products */ = { isa = PBXGroup; children = ( - FCC6D0D01EB38D2F0065F944 /* libSDWebImage iOS static.a */, - FCC6D0D21EB38D2F0065F944 /* libSDWebImage watchOS static.a */, + FCC6D0D01EB38D2F0065F944 /* libSDWebImage.a */, FCC6D0D41EB38D2F0065F944 /* SDWebImage.framework */, - FCC6D0D61EB38D2F0065F944 /* SDWebImage.framework */, - FCC6D0D81EB38D2F0065F944 /* SDWebImage.framework */, - FCC6D0DA1EB38D2F0065F944 /* SDWebImage.framework */, + 3236AC0E226EC00400425AA3 /* SDWebImageMapKit.framework */, ); name = Products; sourceTree = ""; @@ -197,6 +173,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = A28797141DE0C0A60081BDFA; @@ -216,18 +193,18 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - FCC6D0D01EB38D2F0065F944 /* libSDWebImage iOS static.a */ = { + 3236AC0E226EC00400425AA3 /* SDWebImageMapKit.framework */ = { isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libSDWebImage iOS static.a"; - remoteRef = FCC6D0CF1EB38D2F0065F944 /* PBXContainerItemProxy */; + fileType = wrapper.framework; + path = SDWebImageMapKit.framework; + remoteRef = 3236AC0D226EC00400425AA3 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - FCC6D0D21EB38D2F0065F944 /* libSDWebImage watchOS static.a */ = { + FCC6D0D01EB38D2F0065F944 /* libSDWebImage.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = "libSDWebImage watchOS static.a"; - remoteRef = FCC6D0D11EB38D2F0065F944 /* PBXContainerItemProxy */; + path = libSDWebImage.a; + remoteRef = FCC6D0CF1EB38D2F0065F944 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; FCC6D0D41EB38D2F0065F944 /* SDWebImage.framework */ = { @@ -237,27 +214,6 @@ remoteRef = FCC6D0D31EB38D2F0065F944 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - FCC6D0D61EB38D2F0065F944 /* SDWebImage.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = SDWebImage.framework; - remoteRef = FCC6D0D51EB38D2F0065F944 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - FCC6D0D81EB38D2F0065F944 /* SDWebImage.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = SDWebImage.framework; - remoteRef = FCC6D0D71EB38D2F0065F944 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - FCC6D0DA1EB38D2F0065F944 /* SDWebImage.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = SDWebImage.framework; - remoteRef = FCC6D0D91EB38D2F0065F944 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; /* End PBXReferenceProxy section */ /* Begin PBXSourcesBuildPhase section */ @@ -376,7 +332,6 @@ "$(SRCROOT)/../../react-native/Libraries/Image", "$(SRCROOT)/../../../ios/Pods/Headers/Public/**", "$(SRCROOT)/Vendor/SDWebImage", - "$(SRCROOT)/Vendor/SDWebImage/Vendors/FLAnimatedImage", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -393,7 +348,6 @@ "$(SRCROOT)/../../react-native/Libraries/Image", "$(SRCROOT)/../../../ios/Pods/Headers/Public/**", "$(SRCROOT)/Vendor/SDWebImage", - "$(SRCROOT)/Vendor/SDWebImage/Vendors/FLAnimatedImage", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/ios/FastImage/FFFastImageView.h b/ios/FastImage/FFFastImageView.h index d505acf23..fb557cf39 100644 --- a/ios/FastImage/FFFastImageView.h +++ b/ios/FastImage/FFFastImageView.h @@ -1,22 +1,14 @@ #import -#import +#import #import -// Import from the FLAnimated image CocoaPod if it's available. -#if __has_include() -#import -// Import from the version within SDWebImage otherwise. -#elif __has_include() -#import -#endif - #import #import #import "FFFastImageSource.h" -@interface FFFastImageView : FLAnimatedImageView +@interface FFFastImageView : SDAnimatedImageView @property (nonatomic, copy) RCTDirectEventBlock onFastImageLoadStart; @property (nonatomic, copy) RCTDirectEventBlock onFastImageProgress; diff --git a/ios/FastImage/FFFastImageView.m b/ios/FastImage/FFFastImageView.m index 35215c357..ff5d36984 100644 --- a/ios/FastImage/FFFastImageView.m +++ b/ios/FastImage/FFFastImageView.m @@ -148,7 +148,7 @@ - (void)setSource:(FFFastImageSource *)source { options |= SDWebImageRefreshCached; break; case FFFCacheControlCacheOnly: - options |= SDWebImageCacheMemoryOnly; + options |= SDWebImageFromCacheOnly; break; case FFFCacheControlImmutable: break; diff --git a/ios/Vendor/SDWebImage b/ios/Vendor/SDWebImage index ccb8b533c..83997ca9e 160000 --- a/ios/Vendor/SDWebImage +++ b/ios/Vendor/SDWebImage @@ -1 +1 @@ -Subproject commit ccb8b533c65a0e6dde9e8b34129c3c6fb73b11f4 +Subproject commit 83997ca9e4fd7d96ff2d7794e31e3a2fee6b5844 diff --git a/react-native-fast-image-example/ios/ReactNativeFastImageExample/Info.plist b/react-native-fast-image-example/ios/ReactNativeFastImageExample/Info.plist index bc7150692..7968ab019 100644 --- a/react-native-fast-image-example/ios/ReactNativeFastImageExample/Info.plist +++ b/react-native-fast-image-example/ios/ReactNativeFastImageExample/Info.plist @@ -24,22 +24,6 @@ 1 LSRequiresIPhoneOS - NSLocationWhenInUseUsageDescription - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - NSAppTransportSecurity NSAllowsArbitraryLoads @@ -53,6 +37,10 @@ + NSLocationWhenInUseUsageDescription + + NSPhotoLibraryUsageDescription + Need your photos. UIAppFonts AntDesign.ttf @@ -71,5 +59,19 @@ SimpleLineIcons.ttf Zocial.ttf + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + diff --git a/react-native-fast-image.podspec b/react-native-fast-image.podspec index 76d87b7d1..24ffa2ef3 100644 --- a/react-native-fast-image.podspec +++ b/react-native-fast-image.podspec @@ -20,8 +20,5 @@ Pod::Spec.new do |s| s.exclude_files = "ios/Vendor/**/*.{h,m}" s.dependency 'React' - s.dependency 'SDWebImage/Core', '~> 4' - s.dependency 'SDWebImage/GIF', '~> 4' - s.dependency 'SDWebImage/WebP', '~> 4' - s.dependency 'FLAnimatedImage', '~> 1' + s.dependency 'SDWebImage', '~> 5.0' end \ No newline at end of file