Skip to content

Commit 8a216e2

Browse files
dreampiggyDylanVann
authored andcommitted
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
1 parent 14ea01c commit 8a216e2

File tree

6 files changed

+41
-96
lines changed

6 files changed

+41
-96
lines changed

ios/FastImage.xcodeproj/project.pbxproj

+18-64
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
FCC6D1391EB3912D0065F944 /* libSDWebImage iOS static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FCC6D0D01EB38D2F0065F944 /* libSDWebImage iOS static.a */; };
10+
FCC6D1391EB3912D0065F944 /* libSDWebImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FCC6D0D01EB38D2F0065F944 /* libSDWebImage.a */; };
1111
FCFB253F1EA5562700F59778 /* FFFastImageSource.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFB25381EA5562700F59778 /* FFFastImageSource.m */; };
1212
FCFB25401EA5562700F59778 /* FFFastImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFB253A1EA5562700F59778 /* FFFastImageView.m */; };
1313
FCFB25411EA5562700F59778 /* FFFastImageViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFB253C1EA5562700F59778 /* FFFastImageViewManager.m */; };
1414
FCFB25421EA5562700F59778 /* RCTConvert+FFFastImage.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFB253E1EA5562700F59778 /* RCTConvert+FFFastImage.m */; };
1515
/* End PBXBuildFile section */
1616

1717
/* Begin PBXContainerItemProxy section */
18-
FCC6D0CF1EB38D2F0065F944 /* PBXContainerItemProxy */ = {
18+
3236AC0D226EC00400425AA3 /* PBXContainerItemProxy */ = {
1919
isa = PBXContainerItemProxy;
2020
containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */;
2121
proxyType = 2;
22-
remoteGlobalIDString = 53761325155AD0D5005750A4;
23-
remoteInfo = "SDWebImage iOS static";
22+
remoteGlobalIDString = 80B6DFEE2142B71600BCB334;
23+
remoteInfo = SDWebImageMapKit;
2424
};
25-
FCC6D0D11EB38D2F0065F944 /* PBXContainerItemProxy */ = {
25+
FCC6D0CF1EB38D2F0065F944 /* PBXContainerItemProxy */ = {
2626
isa = PBXContainerItemProxy;
2727
containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */;
2828
proxyType = 2;
29-
remoteGlobalIDString = 4314D1991D0E0E3B004B36C9;
30-
remoteInfo = "SDWebImage watchOS static";
29+
remoteGlobalIDString = 53761325155AD0D5005750A4;
30+
remoteInfo = "SDWebImage iOS static";
3131
};
3232
FCC6D0D31EB38D2F0065F944 /* PBXContainerItemProxy */ = {
3333
isa = PBXContainerItemProxy;
@@ -36,27 +36,6 @@
3636
remoteGlobalIDString = 4A2CADFF1AB4BB5300B6BC39;
3737
remoteInfo = "SDWebImage iOS";
3838
};
39-
FCC6D0D51EB38D2F0065F944 /* PBXContainerItemProxy */ = {
40-
isa = PBXContainerItemProxy;
41-
containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */;
42-
proxyType = 2;
43-
remoteGlobalIDString = 00733A4C1BC487C000A5A117;
44-
remoteInfo = "SDWebImage tvOS";
45-
};
46-
FCC6D0D71EB38D2F0065F944 /* PBXContainerItemProxy */ = {
47-
isa = PBXContainerItemProxy;
48-
containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */;
49-
proxyType = 2;
50-
remoteGlobalIDString = 431BB7031D06D2C1006A3455;
51-
remoteInfo = "SDWebImage watchOS";
52-
};
53-
FCC6D0D91EB38D2F0065F944 /* PBXContainerItemProxy */ = {
54-
isa = PBXContainerItemProxy;
55-
containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */;
56-
proxyType = 2;
57-
remoteGlobalIDString = 4397D2F21D0DDD8C00BB2784;
58-
remoteInfo = "SDWebImage OSX";
59-
};
6039
FCC6D1281EB3908E0065F944 /* PBXContainerItemProxy */ = {
6140
isa = PBXContainerItemProxy;
6241
containerPortal = FCC6D0C61EB38D2F0065F944 /* SDWebImage.xcodeproj */;
@@ -96,7 +75,7 @@
9675
isa = PBXFrameworksBuildPhase;
9776
buildActionMask = 2147483647;
9877
files = (
99-
FCC6D1391EB3912D0065F944 /* libSDWebImage iOS static.a in Frameworks */,
78+
FCC6D1391EB3912D0065F944 /* libSDWebImage.a in Frameworks */,
10079
);
10180
runOnlyForDeploymentPostprocessing = 0;
10281
};
@@ -131,12 +110,9 @@
131110
FCC6D0C71EB38D2F0065F944 /* Products */ = {
132111
isa = PBXGroup;
133112
children = (
134-
FCC6D0D01EB38D2F0065F944 /* libSDWebImage iOS static.a */,
135-
FCC6D0D21EB38D2F0065F944 /* libSDWebImage watchOS static.a */,
113+
FCC6D0D01EB38D2F0065F944 /* libSDWebImage.a */,
136114
FCC6D0D41EB38D2F0065F944 /* SDWebImage.framework */,
137-
FCC6D0D61EB38D2F0065F944 /* SDWebImage.framework */,
138-
FCC6D0D81EB38D2F0065F944 /* SDWebImage.framework */,
139-
FCC6D0DA1EB38D2F0065F944 /* SDWebImage.framework */,
115+
3236AC0E226EC00400425AA3 /* SDWebImageMapKit.framework */,
140116
);
141117
name = Products;
142118
sourceTree = "<group>";
@@ -197,6 +173,7 @@
197173
developmentRegion = English;
198174
hasScannedForEncodings = 0;
199175
knownRegions = (
176+
English,
200177
en,
201178
);
202179
mainGroup = A28797141DE0C0A60081BDFA;
@@ -216,18 +193,18 @@
216193
/* End PBXProject section */
217194

218195
/* Begin PBXReferenceProxy section */
219-
FCC6D0D01EB38D2F0065F944 /* libSDWebImage iOS static.a */ = {
196+
3236AC0E226EC00400425AA3 /* SDWebImageMapKit.framework */ = {
220197
isa = PBXReferenceProxy;
221-
fileType = archive.ar;
222-
path = "libSDWebImage iOS static.a";
223-
remoteRef = FCC6D0CF1EB38D2F0065F944 /* PBXContainerItemProxy */;
198+
fileType = wrapper.framework;
199+
path = SDWebImageMapKit.framework;
200+
remoteRef = 3236AC0D226EC00400425AA3 /* PBXContainerItemProxy */;
224201
sourceTree = BUILT_PRODUCTS_DIR;
225202
};
226-
FCC6D0D21EB38D2F0065F944 /* libSDWebImage watchOS static.a */ = {
203+
FCC6D0D01EB38D2F0065F944 /* libSDWebImage.a */ = {
227204
isa = PBXReferenceProxy;
228205
fileType = archive.ar;
229-
path = "libSDWebImage watchOS static.a";
230-
remoteRef = FCC6D0D11EB38D2F0065F944 /* PBXContainerItemProxy */;
206+
path = libSDWebImage.a;
207+
remoteRef = FCC6D0CF1EB38D2F0065F944 /* PBXContainerItemProxy */;
231208
sourceTree = BUILT_PRODUCTS_DIR;
232209
};
233210
FCC6D0D41EB38D2F0065F944 /* SDWebImage.framework */ = {
@@ -237,27 +214,6 @@
237214
remoteRef = FCC6D0D31EB38D2F0065F944 /* PBXContainerItemProxy */;
238215
sourceTree = BUILT_PRODUCTS_DIR;
239216
};
240-
FCC6D0D61EB38D2F0065F944 /* SDWebImage.framework */ = {
241-
isa = PBXReferenceProxy;
242-
fileType = wrapper.framework;
243-
path = SDWebImage.framework;
244-
remoteRef = FCC6D0D51EB38D2F0065F944 /* PBXContainerItemProxy */;
245-
sourceTree = BUILT_PRODUCTS_DIR;
246-
};
247-
FCC6D0D81EB38D2F0065F944 /* SDWebImage.framework */ = {
248-
isa = PBXReferenceProxy;
249-
fileType = wrapper.framework;
250-
path = SDWebImage.framework;
251-
remoteRef = FCC6D0D71EB38D2F0065F944 /* PBXContainerItemProxy */;
252-
sourceTree = BUILT_PRODUCTS_DIR;
253-
};
254-
FCC6D0DA1EB38D2F0065F944 /* SDWebImage.framework */ = {
255-
isa = PBXReferenceProxy;
256-
fileType = wrapper.framework;
257-
path = SDWebImage.framework;
258-
remoteRef = FCC6D0D91EB38D2F0065F944 /* PBXContainerItemProxy */;
259-
sourceTree = BUILT_PRODUCTS_DIR;
260-
};
261217
/* End PBXReferenceProxy section */
262218

263219
/* Begin PBXSourcesBuildPhase section */
@@ -376,7 +332,6 @@
376332
"$(SRCROOT)/../../react-native/Libraries/Image",
377333
"$(SRCROOT)/../../../ios/Pods/Headers/Public/**",
378334
"$(SRCROOT)/Vendor/SDWebImage",
379-
"$(SRCROOT)/Vendor/SDWebImage/Vendors/FLAnimatedImage",
380335
);
381336
OTHER_LDFLAGS = "-ObjC";
382337
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -393,7 +348,6 @@
393348
"$(SRCROOT)/../../react-native/Libraries/Image",
394349
"$(SRCROOT)/../../../ios/Pods/Headers/Public/**",
395350
"$(SRCROOT)/Vendor/SDWebImage",
396-
"$(SRCROOT)/Vendor/SDWebImage/Vendors/FLAnimatedImage",
397351
);
398352
OTHER_LDFLAGS = "-ObjC";
399353
PRODUCT_NAME = "$(TARGET_NAME)";

ios/FastImage/FFFastImageView.h

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
#import <UIKit/UIKit.h>
22

3-
#import <SDWebImage/UIImageView+WebCache.h>
3+
#import <SDWebImage/SDAnimatedImageView+WebCache.h>
44
#import <SDWebImage/SDWebImageDownloader.h>
55

6-
// Import from the FLAnimated image CocoaPod if it's available.
7-
#if __has_include(<FLAnimatedImage/FLAnimatedImageView.h>)
8-
#import <FLAnimatedImage/FLAnimatedImageView.h>
9-
// Import from the version within SDWebImage otherwise.
10-
#elif __has_include(<SDWebImage/FLAnimatedImageView.h>)
11-
#import <SDWebImage/FLAnimatedImageView.h>
12-
#endif
13-
146
#import <React/RCTComponent.h>
157
#import <React/RCTResizeMode.h>
168

179
#import "FFFastImageSource.h"
1810

19-
@interface FFFastImageView : FLAnimatedImageView
11+
@interface FFFastImageView : SDAnimatedImageView
2012

2113
@property (nonatomic, copy) RCTDirectEventBlock onFastImageLoadStart;
2214
@property (nonatomic, copy) RCTDirectEventBlock onFastImageProgress;

ios/FastImage/FFFastImageView.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ - (void)setSource:(FFFastImageSource *)source {
148148
options |= SDWebImageRefreshCached;
149149
break;
150150
case FFFCacheControlCacheOnly:
151-
options |= SDWebImageCacheMemoryOnly;
151+
options |= SDWebImageFromCacheOnly;
152152
break;
153153
case FFFCacheControlImmutable:
154154
break;

ios/Vendor/SDWebImage

react-native-fast-image-example/ios/ReactNativeFastImageExample/Info.plist

+18-16
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@
2424
<string>1</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
27-
<key>NSLocationWhenInUseUsageDescription</key>
28-
<string/>
29-
<key>UILaunchStoryboardName</key>
30-
<string>LaunchScreen</string>
31-
<key>UIRequiredDeviceCapabilities</key>
32-
<array>
33-
<string>armv7</string>
34-
</array>
35-
<key>UISupportedInterfaceOrientations</key>
36-
<array>
37-
<string>UIInterfaceOrientationPortrait</string>
38-
<string>UIInterfaceOrientationLandscapeLeft</string>
39-
<string>UIInterfaceOrientationLandscapeRight</string>
40-
</array>
41-
<key>UIViewControllerBasedStatusBarAppearance</key>
42-
<false/>
4327
<key>NSAppTransportSecurity</key>
4428
<dict>
4529
<key>NSAllowsArbitraryLoads</key>
@@ -53,6 +37,10 @@
5337
</dict>
5438
</dict>
5539
</dict>
40+
<key>NSLocationWhenInUseUsageDescription</key>
41+
<string></string>
42+
<key>NSPhotoLibraryUsageDescription</key>
43+
<string>Need your photos.</string>
5644
<key>UIAppFonts</key>
5745
<array>
5846
<string>AntDesign.ttf</string>
@@ -71,5 +59,19 @@
7159
<string>SimpleLineIcons.ttf</string>
7260
<string>Zocial.ttf</string>
7361
</array>
62+
<key>UILaunchStoryboardName</key>
63+
<string>LaunchScreen</string>
64+
<key>UIRequiredDeviceCapabilities</key>
65+
<array>
66+
<string>armv7</string>
67+
</array>
68+
<key>UISupportedInterfaceOrientations</key>
69+
<array>
70+
<string>UIInterfaceOrientationPortrait</string>
71+
<string>UIInterfaceOrientationLandscapeLeft</string>
72+
<string>UIInterfaceOrientationLandscapeRight</string>
73+
</array>
74+
<key>UIViewControllerBasedStatusBarAppearance</key>
75+
<false/>
7476
</dict>
7577
</plist>

react-native-fast-image.podspec

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,5 @@ Pod::Spec.new do |s|
2020
s.exclude_files = "ios/Vendor/**/*.{h,m}"
2121

2222
s.dependency 'React'
23-
s.dependency 'SDWebImage/Core', '~> 4'
24-
s.dependency 'SDWebImage/GIF', '~> 4'
25-
s.dependency 'SDWebImage/WebP', '~> 4'
26-
s.dependency 'FLAnimatedImage', '~> 1'
23+
s.dependency 'SDWebImage', '~> 5.0'
2724
end

0 commit comments

Comments
 (0)