react-native-fast-image 8.6.35 → 8.6.37
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.
|
@@ -5,6 +5,7 @@ import android.graphics.drawable.Drawable;
|
|
|
5
5
|
import com.bumptech.glide.load.DataSource;
|
|
6
6
|
import com.bumptech.glide.load.engine.GlideException;
|
|
7
7
|
import com.bumptech.glide.load.model.GlideUrl;
|
|
8
|
+
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
|
8
9
|
import com.bumptech.glide.request.Request;
|
|
9
10
|
import com.bumptech.glide.request.RequestListener;
|
|
10
11
|
import com.bumptech.glide.request.target.ImageViewTarget;
|
|
@@ -42,6 +43,11 @@ public class FastImageRequestListener implements RequestListener<Drawable> {
|
|
|
42
43
|
return false;
|
|
43
44
|
}
|
|
44
45
|
final FastImageViewWithUrl view = (FastImageViewWithUrl) ((ImageViewTarget) target).getView();
|
|
46
|
+
if (resource instanceof GifDrawable) {
|
|
47
|
+
// Play the GIF as many times as the file says, as iOS does. Glide
|
|
48
|
+
// loops every GIF forever by default (#651).
|
|
49
|
+
((GifDrawable) resource).setLoopCount(GifDrawable.LOOP_INTRINSIC);
|
|
50
|
+
}
|
|
45
51
|
boolean local = !(model instanceof GlideUrl);
|
|
46
52
|
int[] size = FastImageSourceSize.get(resource, model, local,
|
|
47
53
|
dataSource == DataSource.RESOURCE_DISK_CACHE);
|
|
@@ -168,6 +168,18 @@
|
|
|
168
168
|
}
|
|
169
169
|
// Use SDWebImage API to support external format like WebP images
|
|
170
170
|
UIImage* image = [UIImage sd_imageWithData: [NSData dataWithContentsOfURL: _source.url]];
|
|
171
|
+
if (!image) {
|
|
172
|
+
// Not decodable: fail like a remote image, showing defaultSource.
|
|
173
|
+
[self setImage: _defaultSource];
|
|
174
|
+
self.hasErrored = YES;
|
|
175
|
+
if (self.onFastImageError) {
|
|
176
|
+
self.onFastImageError(@{});
|
|
177
|
+
}
|
|
178
|
+
if (self.onFastImageLoadEnd) {
|
|
179
|
+
self.onFastImageLoadEnd(@{});
|
|
180
|
+
}
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
171
183
|
[self setImage: image];
|
|
172
184
|
if (self.onFastImageProgress) {
|
|
173
185
|
self.onFastImageProgress(@{
|