Upgrade Kingfisher to fix a bug that prevented GIFs from being tapped. (#3326)

* Upgrade Kingfisher to fix a bug the prevented GIFs from being tapped.

https://github.com/onevcat/Kingfisher/issues/2295

* Fix tests.
This commit is contained in:
Doug
2024-09-25 13:10:02 +01:00
committed by GitHub
parent 864bd23d35
commit af8c16150b
5 changed files with 9 additions and 18 deletions
@@ -38,8 +38,8 @@ struct MediaProvider: MediaProviderProtocol {
}
let cacheKey = cacheKeyForURL(source.url, size: size)
if case let .success(cacheResult) = await imageCache.retrieveImage(forKey: cacheKey),
if let cacheResult = try? await imageCache.retrieveImage(forKey: cacheKey, options: nil),
let image = cacheResult.image {
return .success(image)
}
@@ -57,7 +57,7 @@ struct MediaProvider: MediaProviderProtocol {
return .failure(.invalidImageData)
}
imageCache.store(image, forKey: cacheKey)
try await imageCache.store(image, forKey: cacheKey)
return .success(image)
} catch {
@@ -149,13 +149,3 @@ struct MediaProvider: MediaProviderProtocol {
}
}
}
private extension ImageCache {
func retrieveImage(forKey key: String) async -> Result<ImageCacheResult, KingfisherError> {
await withCheckedContinuation { continuation in
retrieveImage(forKey: key) { result in
continuation.resume(returning: result)
}
}
}
}