1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-17 20:10:23 +01:00

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
ImageDiskCache.service = try ImageSerializationService(environment: environment)
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,
FileManager.default.fileExists(atPath: legacyImageCacheDirectoryURL.path) {