Merge pull request #3110 from kinarobin/fix-disk-image-fetch-bug
Fixed the store cache type was specified to `SDImageCacheTypeDisk ` that no pictures were obtained when the disk had pictures
This commit is contained in:
commit
39baf0bba6
|
@ -537,15 +537,13 @@ static NSString * _defaultDiskCacheDirectory;
|
|||
SDImageCacheType cacheType = [context[SDWebImageContextStoreCacheType] integerValue];
|
||||
shouldCacheToMomery = (cacheType == SDImageCacheTypeAll || cacheType == SDImageCacheTypeMemory);
|
||||
}
|
||||
if (shouldCacheToMomery) {
|
||||
// decode image data only if in-memory cache missed
|
||||
diskImage = [self diskImageForKey:key data:diskData options:options context:context];
|
||||
if (diskImage && self.config.shouldCacheImagesInMemory) {
|
||||
if (shouldCacheToMomery && diskImage && self.config.shouldCacheImagesInMemory) {
|
||||
NSUInteger cost = diskImage.sd_memoryCost;
|
||||
[self.memoryCache setObject:diskImage forKey:key cost:cost];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (doneBlock) {
|
||||
if (shouldQueryDiskSync) {
|
||||
|
|
|
@ -632,6 +632,7 @@ static NSString *kTestImageKeyPNG = @"TestImageKey.png";
|
|||
[[SDImageCache sharedImageCache] storeImageDataToDisk:data forKey:kTestImageKeyJPEG];
|
||||
|
||||
[[SDImageCachesManager sharedManager] queryImageForKey:kTestImageKeyJPEG options:0 context:@{SDWebImageContextStoreCacheType : @(SDImageCacheTypeDisk)} cacheType:SDImageCacheTypeAll completion:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) {
|
||||
expect(image).notTo.beNil();
|
||||
expect([[SDImageCache sharedImageCache] imageFromMemoryCacheForKey:kTestImageKeyJPEG]).beNil();
|
||||
[expectation fulfill];
|
||||
}];
|
||||
|
|
Loading…
Reference in New Issue