It would be nice to allow OkHttpNetworkFetcher to be built using the more generic OkHttp Call.Factory, rather than the concrete OkHttpClient class. Using Call.Factory was previously an option for building ImageLoaders in Coil 2.x.
As a side note, it was also nice to have the lazy/non-lazy options, and also the () -> X rather than Lazy<X> initializer, given that Kotlin's Lazy is not a functional interface (not sure if there are any other considerations though).
Great callout - fixed here. I'll remove Lazy from the public API as well. In the meantime you can create a functional lazy using callFactory = lazy { OkHttpClient() }
Describe the solution you'd like
It would be nice to allow OkHttpNetworkFetcher to be built using the more generic OkHttp Call.Factory, rather than the concrete OkHttpClient class. Using Call.Factory was previously an option for building ImageLoaders in Coil 2.x.
As a side note, it was also nice to have the lazy/non-lazy options, and also the
() -> X
rather thanLazy<X>
initializer, given that Kotlin'sLazy
is not a functional interface (not sure if there are any other considerations though).Additional context
Pull request #50
Coil 2.x: https://github.com/coil-kt/coil/blob/66a6f5ed1ec3b57f7aa031c0e584e484b7948d57/coil-base/src/main/java/coil/ImageLoader.kt#L153 https://github.com/coil-kt/coil/blob/66a6f5ed1ec3b57f7aa031c0e584e484b7948d57/coil-base/src/main/java/coil/ImageLoader.kt#L165 https://github.com/coil-kt/coil/blob/66a6f5ed1ec3b57f7aa031c0e584e484b7948d57/coil-base/src/main/java/coil/ImageLoader.kt#L170 https://github.com/coil-kt/coil/blob/66a6f5ed1ec3b57f7aa031c0e584e484b7948d57/coil-base/src/main/java/coil/ImageLoader.kt#L182