react-native-fast-image 8.13.0 → 8.13.2
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.
|
@@ -18,7 +18,6 @@ import com.bumptech.glide.RequestManager;
|
|
|
18
18
|
import com.bumptech.glide.load.model.GlideUrl;
|
|
19
19
|
import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy;
|
|
20
20
|
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
|
21
|
-
import com.bumptech.glide.request.Request;
|
|
22
21
|
import com.bumptech.glide.request.RequestOptions;
|
|
23
22
|
import com.bumptech.glide.request.target.DrawableImageViewTarget;
|
|
24
23
|
import com.bumptech.glide.request.target.SizeReadyCallback;
|
|
@@ -472,7 +471,9 @@ class FastImageViewWithUrl extends AppCompatImageView {
|
|
|
472
471
|
}
|
|
473
472
|
|
|
474
473
|
public void clearView(@Nullable RequestManager requestManager) {
|
|
475
|
-
|
|
474
|
+
// Glide keeps the view's request under its own tag id, not getTag().
|
|
475
|
+
// Without a request this does nothing.
|
|
476
|
+
if (requestManager != null) {
|
|
476
477
|
requestManager.clear(this);
|
|
477
478
|
}
|
|
478
479
|
}
|
|
@@ -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
|