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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 9 additions and 18 deletions

View File

@ -7839,7 +7839,7 @@
repositoryURL = "https://github.com/onevcat/Kingfisher"; repositoryURL = "https://github.com/onevcat/Kingfisher";
requirement = { requirement = {
kind = upToNextMinorVersion; kind = upToNextMinorVersion;
minimumVersion = 7.6.0; minimumVersion = 8.0.3;
}; };
}; };
D5F7D47BBAAE0CF1DDEB3034 /* XCRemoteSwiftPackageReference "DeviceKit" */ = { D5F7D47BBAAE0CF1DDEB3034 /* XCRemoteSwiftPackageReference "DeviceKit" */ = {

View File

@ -86,8 +86,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/onevcat/Kingfisher", "location" : "https://github.com/onevcat/Kingfisher",
"state" : { "state" : {
"revision" : "af4be924ad984cf4d16f4ae4df424e79a443d435", "revision" : "33696a71dd4d71f1b0f781ade11a48ba5549581a",
"version" : "7.6.2" "version" : "8.0.3"
} }
}, },
{ {

View File

@ -39,7 +39,7 @@ struct MediaProvider: MediaProviderProtocol {
let cacheKey = cacheKeyForURL(source.url, size: size) 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 { let image = cacheResult.image {
return .success(image) return .success(image)
} }
@ -57,7 +57,7 @@ struct MediaProvider: MediaProviderProtocol {
return .failure(.invalidImageData) return .failure(.invalidImageData)
} }
imageCache.store(image, forKey: cacheKey) try await imageCache.store(image, forKey: cacheKey)
return .success(image) return .success(image)
} catch { } 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)
}
}
}
}

View File

@ -5,7 +5,7 @@
// Please see LICENSE in the repository root for full details. // Please see LICENSE in the repository root for full details.
// //
@testable import ElementX @testable import ElementX
import Kingfisher @testable import Kingfisher
import UIKit import UIKit
class MockImageCache: ImageCache { class MockImageCache: ImageCache {
@ -35,5 +35,6 @@ class MockImageCache: ImageCache {
callbackQueue: CallbackQueue = .untouch, callbackQueue: CallbackQueue = .untouch,
completionHandler: ((CacheStoreResult) -> Void)? = nil) { completionHandler: ((CacheStoreResult) -> Void)? = nil) {
storedImages[key] = image storedImages[key] = image
completionHandler?(.init(memoryCacheResult: .success(()), diskCacheResult: .success(())))
} }
} }

View File

@ -106,7 +106,7 @@ packages:
minorVersion: 4.2.0 minorVersion: 4.2.0
Kingfisher: Kingfisher:
url: https://github.com/onevcat/Kingfisher url: https://github.com/onevcat/Kingfisher
minorVersion: 7.6.0 minorVersion: 8.0.3
KZFileWatchers: KZFileWatchers:
url: https://github.com/krzysztofzablocki/KZFileWatchers url: https://github.com/krzysztofzablocki/KZFileWatchers
minorVersion: 1.2.0 minorVersion: 1.2.0