mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-10 18:28:48 +00:00
Fixed media provider performance.
This commit is contained in:
@@ -30,11 +30,16 @@ struct MediaProvider: MediaProviderProtocol {
|
||||
}
|
||||
|
||||
func loadImageFromURL(_ url: String, _ completion: @escaping (Result<UIImage, MediaProviderError>) -> Void) {
|
||||
if let image = imageForURL(url) {
|
||||
completion(.success(image))
|
||||
return
|
||||
}
|
||||
|
||||
imageCache.retrieveImage(forKey: url) { result in
|
||||
if case let .success(cacheResult) = result,
|
||||
let image = cacheResult.image {
|
||||
completion(.success(image))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
processingQueue.async {
|
||||
@@ -62,4 +67,5 @@ struct MediaProvider: MediaProviderProtocol {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user