@@ -104,24 +104,24 @@ export class ImagePipeline {
104104 return SDWebImageManager . sharedManager . cacheKeyForURLContext ( NSURL . URLWithString ( uri ) , context ) ;
105105 }
106106
107- isInDiskCache ( uri : string ) : boolean {
108- return this . mIos . diskImageDataExistsWithKey ( getUri ( uri ) . absoluteString ) ;
107+ isInDiskCache ( key : string ) : boolean {
108+ return this . mIos . diskImageDataExistsWithKey ( key ) ;
109109 }
110110
111- isInBitmapMemoryCache ( uri : string ) : boolean {
112- return this . mIos . imageFromMemoryCacheForKey ( getUri ( uri ) . absoluteString ) !== null ;
111+ isInBitmapMemoryCache ( key : string ) : boolean {
112+ return this . mIos . imageFromMemoryCacheForKey ( key ) !== null ;
113113 }
114114
115- evictFromMemoryCache ( uri : string ) : void {
116- this . mIos . removeImageFromMemoryForKey ( getUri ( uri ) . absoluteString ) ;
115+ evictFromMemoryCache ( key : string ) : void {
116+ this . mIos . removeImageFromMemoryForKey ( key ) ;
117117 }
118118
119- evictFromDiskCache ( uri : string ) : void {
120- this . mIos . removeImageFromDiskForKey ( getUri ( uri ) . absoluteString ) ;
119+ evictFromDiskCache ( key : string ) : void {
120+ this . mIos . removeImageFromDiskForKey ( key ) ;
121121 }
122122
123- evictFromCache ( uri : string ) : void {
124- const key = getUri ( uri ) . absoluteString ;
123+ evictFromCache ( key : string ) : void {
124+ // const key = getUri(uri).absoluteString;
125125 this . mIos . removeImageFromDiskForKey ( key ) ;
126126 this . mIos . removeImageFromMemoryForKey ( key ) ;
127127 // this.mIos.removeImageForKeyWithCompletion(getUri(uri).absoluteString, null);
@@ -222,6 +222,11 @@ export class Img extends ImageBase {
222222 //@ts -ignore
223223 nativeImageViewProtected : SDAnimatedImageView | UIImageView ;
224224 isLoading = false ;
225+ mCacheKey :string
226+
227+ get cacheKey ( ) {
228+ return this . mCacheKey
229+ }
225230 protected mImageSourceAffectsLayout : boolean = true ;
226231 protected mCIFilter : CIFilter ;
227232 public createNativeView ( ) {
@@ -278,13 +283,15 @@ export class Img extends ImageBase {
278283 const imagePipeLine = getImagePipeline ( ) ;
279284 const src = this . src ;
280285 if ( ! ( src instanceof ImageSource ) ) {
281- const uri = getUri ( src ) . absoluteString ;
282- const isInCache = imagePipeLine . isInBitmapMemoryCache ( uri ) ;
283- if ( isInCache ) {
284- imagePipeLine . evictFromCache ( uri ) ;
285- }
286+ const cachekKey = this . mCacheKey || getUri ( src ) . absoluteString ;
287+ // const isInCache = imagePipeLine.isInBitmapMemoryCache(cachekKey );
288+ // if (isInCache) {
289+ imagePipeLine . evictFromCache ( cachekKey ) ;
290+ // }
286291 }
287292 this . src = null ;
293+ // ensure we clear the image as
294+ this . _setNativeImage ( null , false ) ;
288295 this . src = src ;
289296 }
290297
@@ -315,9 +322,8 @@ export class Img extends ImageBase {
315322 } else {
316323 this . nativeImageViewProtected . image = nativeImage ;
317324 }
318-
319325 if ( this . mImageSourceAffectsLayout ) {
320- this . mImageSourceAffectsLayout = false ;
326+ // this.mImageSourceAffectsLayout = false;
321327 this . requestLayout ( ) ;
322328 }
323329 }
@@ -463,6 +469,7 @@ export class Img extends ImageBase {
463469 }
464470 context . setValueForKey ( SDImagePipelineTransformer . transformerWithTransformers ( transformers ) , SDWebImageContextImageTransformer ) ;
465471 }
472+ this . mCacheKey = SDWebImageManager . sharedManager . cacheKeyForURLContext ( uri , context )
466473 this . nativeImageViewProtected . sd_setImageWithURLPlaceholderImageOptionsContextProgressCompleted (
467474 uri ,
468475 this . placeholderImage ,
0 commit comments