Replies: 1 comment
-
if you are using coil with ktor, I think you can add package coil3.network.ktor
/* ... */
@JvmName("factory")
fun KtorNetworkFetcherFactory() = NetworkFetcher.Factory(
networkClient = { HttpClient().asNetworkClient() },
cacheStrategy = { CacheStrategy() },
)
/* ... */ the code will look like: setSingletonImageLoaderFactory { context ->
ImageLoader.Builder(context)
.components {
add(factory = KtorNetworkFetcherFactory()) // HERE
}.diskCache {
DiskCache.Builder()
.directory(helper.getCacheDir().toPath())
.maxSizePercent(0.1)
.build()
}
.build()
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
in coil 3 alpha-03 networkClient and cacheStrategy is required and i don't know how can i set it.
i didn't find any description in coil documents.
i want to add my ktor client and default cacheStrategy
please help me
Beta Was this translation helpful? Give feedback.
All reactions