Fix the issue when using thumbnailPixelSize and optionsProcessor
This commit is contained in:
parent
d9fd4726ea
commit
94aadc1927
|
@ -106,18 +106,20 @@ public final class ImageManager : ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
/// Prefetch the initial state of image
|
||||
internal func prefetch() {
|
||||
let key = manager.cacheKey(for: url)
|
||||
if let imageCache = manager.imageCache as? SDImageCache {
|
||||
self.image = imageCache.imageFromMemoryCache(forKey: key)
|
||||
} else {
|
||||
// generic API
|
||||
manager.imageCache.containsImage(forKey: key, cacheType: .memory) { [unowned self] (cacheType) in
|
||||
if cacheType == .memory {
|
||||
self.manager.imageCache.queryImage(forKey: key, options: self.options, context: self.context) { [unowned self] (image, data, cacheType) in
|
||||
self.image = image
|
||||
}
|
||||
/// Prefetch the initial state of image, currently query the memory cache only
|
||||
func prefetch() {
|
||||
// Use the options processor if provided
|
||||
var context = self.context
|
||||
if let result = manager.optionsProcessor?.processedResult(for: url, options: options, context: context) {
|
||||
context = result.context
|
||||
}
|
||||
// TODO: before SDWebImage 5.7.0, this is the SPI. Remove later
|
||||
let key = manager.perform(Selector(("cacheKeyForURL:context:")), with: url, with: context)?.takeUnretainedValue() as? String
|
||||
// This callback is synchronzied
|
||||
manager.imageCache.containsImage(forKey: key, cacheType: .memory) { [unowned self] (cacheType) in
|
||||
if cacheType == .memory {
|
||||
self.manager.imageCache.queryImage(forKey: key, options: self.options, context: self.context) { [unowned self] (image, data, cacheType) in
|
||||
self.image = image
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue