File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change @@ -4,12 +4,14 @@ import Nuke
44enum 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}
You can’t perform that action at this time.
0 commit comments