mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +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) {
|
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
|
imageCache.retrieveImage(forKey: url) { result in
|
||||||
if case let .success(cacheResult) = result,
|
if case let .success(cacheResult) = result,
|
||||||
let image = cacheResult.image {
|
let image = cacheResult.image {
|
||||||
completion(.success(image))
|
completion(.success(image))
|
||||||
}
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
processingQueue.async {
|
processingQueue.async {
|
||||||
@@ -63,3 +68,4 @@ struct MediaProvider: MediaProviderProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user