react-native-fast-image 8.16.0 → 8.16.1
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
CHANGED
|
@@ -349,6 +349,8 @@ for (const result of results) {
|
|
|
349
349
|
}
|
|
350
350
|
```
|
|
351
351
|
|
|
352
|
+
Each source's `cache` applies, as for a view: with `web` the preload follows the HTTP cache, and with `cacheOnly` it doesn't download. A `cacheOnly` preload resolves `ok` only if the image is cached, and loads it from the disk cache into memory, so a view shows it at once.
|
|
353
|
+
|
|
352
354
|
### `FastImage.clearMemoryCache: () => Promise<void>`
|
|
353
355
|
|
|
354
356
|
Clear all images from memory cache.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#import <UIKit/UIKit.h>
|
|
3
3
|
#import <SDWebImage/SDWebImageDownloaderRequestModifier.h>
|
|
4
4
|
#import <SDWebImage/SDWebImageCacheKeyFilter.h>
|
|
5
|
+
#import <SDWebImage/SDWebImageDefine.h>
|
|
5
6
|
|
|
6
7
|
typedef NS_ENUM(NSInteger, FFFPriority) {
|
|
7
8
|
FFFPriorityLow,
|
|
@@ -42,4 +43,8 @@ typedef NS_ENUM(NSInteger, FFFCacheControl) {
|
|
|
42
43
|
// Caches the image under cacheKey, or nil without one.
|
|
43
44
|
- (SDWebImageCacheKeyFilter *)cacheKeyFilter;
|
|
44
45
|
|
|
46
|
+
// The load options for `cache`: web follows the HTTP cache, cacheOnly never
|
|
47
|
+
// downloads. For views and preload alike.
|
|
48
|
+
- (SDWebImageOptions)cacheOptions;
|
|
49
|
+
|
|
45
50
|
@end
|
|
@@ -29,6 +29,19 @@
|
|
|
29
29
|
}];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
- (SDWebImageOptions)cacheOptions
|
|
33
|
+
{
|
|
34
|
+
switch (_cacheControl) {
|
|
35
|
+
case FFFCacheControlWeb:
|
|
36
|
+
return SDWebImageRefreshCached;
|
|
37
|
+
case FFFCacheControlCacheOnly:
|
|
38
|
+
return SDWebImageFromCacheOnly;
|
|
39
|
+
case FFFCacheControlImmutable:
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
32
45
|
- (SDWebImageDownloaderRequestModifier *)requestModifier
|
|
33
46
|
{
|
|
34
47
|
NSDictionary* headers = _headers;
|
|
@@ -500,17 +500,7 @@ NSString *FFFErrorMessage(NSError *error)
|
|
|
500
500
|
break;
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
-
|
|
504
|
-
case FFFCacheControlWeb:
|
|
505
|
-
options |= SDWebImageRefreshCached;
|
|
506
|
-
break;
|
|
507
|
-
case FFFCacheControlCacheOnly:
|
|
508
|
-
options |= SDWebImageFromCacheOnly;
|
|
509
|
-
break;
|
|
510
|
-
case FFFCacheControlImmutable:
|
|
511
|
-
break;
|
|
512
|
-
}
|
|
513
|
-
return options;
|
|
503
|
+
return options | [_source cacheOptions];
|
|
514
504
|
}
|
|
515
505
|
|
|
516
506
|
// Headers, and the size to decode at (see FFFDownsampledImage), which it
|
|
@@ -89,8 +89,9 @@ RCT_EXPORT_METHOD(preload:(nonnull NSArray<FFFastImageSource *> *)sources
|
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
// With the prefetcher's options (low priority), but one source at a
|
|
92
|
-
// time (not SDWebImagePrefetcher), to get each source's result
|
|
93
|
-
// send its headers with its own request only
|
|
92
|
+
// time (not SDWebImagePrefetcher), to get each source's result, to
|
|
93
|
+
// send its headers with its own request only, and to follow its
|
|
94
|
+
// `cache` (#406).
|
|
94
95
|
SDWebImageOptions prefetcherOptions = [SDWebImagePrefetcher sharedImagePrefetcher].options;
|
|
95
96
|
|
|
96
97
|
[sources enumerateObjectsUsingBlock:^(FFFastImageSource * _Nonnull source, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
@@ -112,6 +113,7 @@ RCT_EXPORT_METHOD(preload:(nonnull NSArray<FFFastImageSource *> *)sources
|
|
|
112
113
|
options |= SDWebImageHighPriority;
|
|
113
114
|
}
|
|
114
115
|
}
|
|
116
|
+
options |= [source cacheOptions];
|
|
115
117
|
[FFFPendingPreloads addObject:[^{
|
|
116
118
|
// Once per slot: SDWebImage calls this once with finished set
|
|
117
119
|
// (a progressive load calls it more, without).
|