Skip to content

Commit 13a92b5

Browse files
authored
Merge branch 'main' into fix/android-skip-unchanged-image-reload
2 parents 60b662d + 21e8a17 commit 13a92b5

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

ios/TurboImageViewManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extension TurboImageViewManager {
3939
let key = UUID().uuidString
4040
var prefetcher: ImagePrefetcher?
4141
if(cachePolicy == "dataCache") {
42-
prefetcher = ImagePrefetcher(pipeline: ImagePipeline(configuration: .withDataCache))
42+
prefetcher = ImagePrefetcher(pipeline: CachePolicy.dataCachePipeline)
4343
} else {
4444
prefetcher = ImagePrefetcher()
4545
}
@@ -61,7 +61,7 @@ extension TurboImageViewManager {
6161
@objc
6262
func clearDiskCache(_ resolve: @escaping RCTPromiseResolveBlock,
6363
reject: @escaping RCTPromiseRejectBlock) {
64-
ImagePipeline(configuration: .withDataCache).cache.removeAll()
64+
CachePolicy.dataCachePipeline.cache.removeAll()
6565
DataLoader.sharedUrlCache.removeAllCachedResponses()
6666
resolve("Success")
6767
}

ios/Utilities/CachePolicy.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import Nuke
44
enum CachePolicy: String {
55
case urlCache, dataCache
66

7+
static let dataCachePipeline = ImagePipeline(configuration: .withDataCache)
8+
79
var pipeline: ImagePipeline {
810
switch self {
911
case .urlCache:
1012
return .shared
1113
case .dataCache:
12-
return ImagePipeline(configuration: .withDataCache)
14+
return Self.dataCachePipeline
1315
}
1416
}
1517
}

0 commit comments

Comments
 (0)