Skip to content

Commit 72f3ed6

Browse files
committed
fix(ios): new contextOptions property to pass
to SDWebImage
1 parent d9a9465 commit 72f3ed6

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/image-colorfilter/index.ios.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class ImgExtended3 {
5454
mCIFilter: CIFilter;
5555

5656
filteredImage(image: UIImage, filter: CIFilter) {
57-
console.log('filteredImage', image, filter);
5857
if (image !== null && filter !== null) {
5958
const tmp = CIImage.alloc().initWithImage(image);
6059
this.mCIFilter.setValueForKey(tmp, 'inputImage');

src/image/index.ios.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ export class Img extends ImageBase {
229229
isLoading = false;
230230
mCacheKey: string;
231231

232+
contextOptions = null
233+
232234
get cacheKey() {
233235
return this.mCacheKey;
234236
}
@@ -302,10 +304,10 @@ export class Img extends ImageBase {
302304
await imagePipeLine.evictFromCache(cachekKey);
303305
// }
304306
}
305-
this.src = null;
307+
// this.src = null;
306308
// ensure we clear the image as
307309
this._setNativeImage(null, false);
308-
this.src = src;
310+
this.initImage();
309311
}
310312

311313
public _setNativeImage(nativeImage: UIImage, animated = true) {
@@ -489,6 +491,13 @@ export class Img extends ImageBase {
489491
options |= SDWebImageOptions.TransformAnimatedImage;
490492
}
491493
context.setValueForKey(SDImagePipelineTransformer.transformerWithTransformers(transformers), SDWebImageContextImageTransformer);
494+
// context.setValueForKey(SDImageCacheType.Memory, SDWebImageContextOriginalStoreCacheType);
495+
}
496+
if (this.contextOptions && typeof this.contextOptions === 'object') {
497+
Object.keys(this.contextOptions).forEach(k=>{
498+
let value = this.contextOptions[k];
499+
context.setValueForKey(value, k);
500+
})
492501
}
493502
this.mCacheKey = SDWebImageManager.sharedManager.cacheKeyForURLContext(uri, context);
494503
this.nativeImageViewProtected.sd_setImageWithURLPlaceholderImageOptionsContextProgressCompleted(

0 commit comments

Comments
 (0)