Set retry and continue in background image options

This commit is contained in:
Justin Mazzocchi 2021-03-03 17:26:07 -08:00
parent 19963de055
commit e245569e1a
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C

View file

@ -17,6 +17,14 @@ extension ImageCacheConfiguration {
SDImageCache.defaultDiskCacheDirectory = Self.imageCacheDirectoryURL?.path SDImageCache.defaultDiskCacheDirectory = Self.imageCacheDirectoryURL?.path
ImageDiskCache.service = try ImageSerializationService(environment: environment) ImageDiskCache.service = try ImageSerializationService(environment: environment)
SDImageCacheConfig.default.diskCacheClass = ImageDiskCache.self SDImageCacheConfig.default.diskCacheClass = ImageDiskCache.self
SDWebImageManager.shared.optionsProcessor = SDWebImageOptionsProcessor { _, options, context in
var mutableOptions = options
mutableOptions.insert(.retryFailed)
mutableOptions.insert(.continueInBackground)
return SDWebImageOptionsResult(options: options, context: context)
}
if let legacyImageCacheDirectoryURL = Self.legacyImageCacheDirectoryURL, if let legacyImageCacheDirectoryURL = Self.legacyImageCacheDirectoryURL,
FileManager.default.fileExists(atPath: legacyImageCacheDirectoryURL.path) { FileManager.default.fileExists(atPath: legacyImageCacheDirectoryURL.path) {