react-native-fast-image 8.13.0 → 8.13.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.
|
@@ -404,6 +404,12 @@ NSString *FFFErrorMessage(NSError *error)
|
|
|
404
404
|
_needsReload = NO;
|
|
405
405
|
self.waitsForSize = NO;
|
|
406
406
|
self.decodedBox = CGSizeZero;
|
|
407
|
+
// The previous load, if it's still running, is for a source the view no
|
|
408
|
+
// longer shows: cancel it (a new download would, but a data uri or no
|
|
409
|
+
// source doesn't start one), and ignore what it still sends (SDWebImage
|
|
410
|
+
// completes a cancelled load with an error; see downloadImage:).
|
|
411
|
+
self.loadCount++;
|
|
412
|
+
[self sd_cancelCurrentImageLoad];
|
|
407
413
|
|
|
408
414
|
if (_source) {
|
|
409
415
|
// Load base64 images.
|
|
@@ -572,12 +578,19 @@ NSString *FFFErrorMessage(NSError *error)
|
|
|
572
578
|
return;
|
|
573
579
|
}
|
|
574
580
|
// Like SDAnimatedImageView's sd_setImageWithURL, which sets the image
|
|
575
|
-
// class to SDAnimatedImage (loadContext sets it).
|
|
581
|
+
// class to SDAnimatedImage (loadContext sets it). Only while this is the
|
|
582
|
+
// current load: SDWebImage sets the placeholder when a load it cancelled
|
|
583
|
+
// completes, which could replace a newer image.
|
|
584
|
+
SDSetImageBlock setImage = ^(UIImage* _Nullable image, NSData* _Nullable data, SDImageCacheType cacheType, NSURL* _Nullable imageURL) {
|
|
585
|
+
if (weakSelf.loadCount == load) {
|
|
586
|
+
weakSelf.image = image;
|
|
587
|
+
}
|
|
588
|
+
};
|
|
576
589
|
[self sd_internalSetImageWithURL: url
|
|
577
590
|
placeholderImage: _defaultSource
|
|
578
591
|
options: options
|
|
579
592
|
context: context
|
|
580
|
-
setImageBlock:
|
|
593
|
+
setImageBlock: setImage
|
|
581
594
|
progress: progress
|
|
582
595
|
completed: ^(UIImage* _Nullable image,
|
|
583
596
|
NSData* _Nullable data,
|
|
@@ -585,9 +598,10 @@ NSString *FFFErrorMessage(NSError *error)
|
|
|
585
598
|
SDImageCacheType cacheType,
|
|
586
599
|
BOOL finished,
|
|
587
600
|
NSURL* _Nullable imageURL) {
|
|
588
|
-
//
|
|
589
|
-
// sends the events.
|
|
590
|
-
|
|
601
|
+
// Replaced by another load (a new source, or the same one
|
|
602
|
+
// restarted for a new size), which sends the events. This
|
|
603
|
+
// one was cancelled, which SDWebImage reports as an error.
|
|
604
|
+
if (weakSelf.loadCount != load) {
|
|
591
605
|
return;
|
|
592
606
|
}
|
|
593
607
|
// The download was running when the app went to the
|