Skip to content

Commit

Permalink
feat: Upgrade to SDWebImage 5.0. (DylanVann#454)
Browse files Browse the repository at this point in the history
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 DylanVann#447
  • Loading branch information
dreampiggy authored and DylanVann committed May 8, 2019
1 parent 14ea01c commit 8a216e2
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 96 deletions.
82 changes: 18 additions & 64 deletions ios/FastImage.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
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 */; };
FCFB25421EA5562700F59778 /* RCTConvert+FFFastImage.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFB253E1EA5562700F59778 /* RCTConvert+FFFastImage.m */; };
/* 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;
Expand All @@ -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 */;
Expand Down Expand Up @@ -96,7 +75,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FCC6D1391EB3912D0065F944 /* libSDWebImage iOS static.a in Frameworks */,
FCC6D1391EB3912D0065F944 /* libSDWebImage.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -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 = "<group>";
Expand Down Expand Up @@ -197,6 +173,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = A28797141DE0C0A60081BDFA;
Expand All @@ -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 */ = {
Expand All @@ -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 */
Expand Down Expand Up @@ -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)";
Expand All @@ -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)";
Expand Down
12 changes: 2 additions & 10 deletions ios/FastImage/FFFastImageView.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
#import <UIKit/UIKit.h>

#import <SDWebImage/UIImageView+WebCache.h>
#import <SDWebImage/SDAnimatedImageView+WebCache.h>
#import <SDWebImage/SDWebImageDownloader.h>

// Import from the FLAnimated image CocoaPod if it's available.
#if __has_include(<FLAnimatedImage/FLAnimatedImageView.h>)
#import <FLAnimatedImage/FLAnimatedImageView.h>
// Import from the version within SDWebImage otherwise.
#elif __has_include(<SDWebImage/FLAnimatedImageView.h>)
#import <SDWebImage/FLAnimatedImageView.h>
#endif

#import <React/RCTComponent.h>
#import <React/RCTResizeMode.h>

#import "FFFastImageSource.h"

@interface FFFastImageView : FLAnimatedImageView
@interface FFFastImageView : SDAnimatedImageView

@property (nonatomic, copy) RCTDirectEventBlock onFastImageLoadStart;
@property (nonatomic, copy) RCTDirectEventBlock onFastImageProgress;
Expand Down
2 changes: 1 addition & 1 deletion ios/FastImage/FFFastImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ - (void)setSource:(FFFastImageSource *)source {
options |= SDWebImageRefreshCached;
break;
case FFFCacheControlCacheOnly:
options |= SDWebImageCacheMemoryOnly;
options |= SDWebImageFromCacheOnly;
break;
case FFFCacheControlImmutable:
break;
Expand Down
2 changes: 1 addition & 1 deletion ios/Vendor/SDWebImage
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,6 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand All @@ -53,6 +37,10 @@
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Need your photos.</string>
<key>UIAppFonts</key>
<array>
<string>AntDesign.ttf</string>
Expand All @@ -71,5 +59,19 @@
<string>SimpleLineIcons.ttf</string>
<string>Zocial.ttf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
5 changes: 1 addition & 4 deletions react-native-fast-image.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8a216e2

Please sign in to comment.