mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Let coil use our OkHttpClient.
This commit is contained in:
committed by
Benoit Marty
parent
a68b3f80eb
commit
771855dfe3
+5
@@ -21,15 +21,18 @@ import coil.ImageLoader
|
|||||||
import coil.ImageLoaderFactory
|
import coil.ImageLoaderFactory
|
||||||
import io.element.android.libraries.di.ApplicationContext
|
import io.element.android.libraries.di.ApplicationContext
|
||||||
import io.element.android.libraries.matrix.api.MatrixClient
|
import io.element.android.libraries.matrix.api.MatrixClient
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class LoggedInImageLoaderFactory @Inject constructor(
|
class LoggedInImageLoaderFactory @Inject constructor(
|
||||||
@ApplicationContext private val context: Context,
|
@ApplicationContext private val context: Context,
|
||||||
private val matrixClient: MatrixClient,
|
private val matrixClient: MatrixClient,
|
||||||
|
private val okHttpClient: OkHttpClient,
|
||||||
) : ImageLoaderFactory {
|
) : ImageLoaderFactory {
|
||||||
override fun newImageLoader(): ImageLoader {
|
override fun newImageLoader(): ImageLoader {
|
||||||
return ImageLoader
|
return ImageLoader
|
||||||
.Builder(context)
|
.Builder(context)
|
||||||
|
.okHttpClient(okHttpClient)
|
||||||
.components {
|
.components {
|
||||||
add(AvatarKeyer())
|
add(AvatarKeyer())
|
||||||
add(MediaKeyer())
|
add(MediaKeyer())
|
||||||
@@ -42,10 +45,12 @@ class LoggedInImageLoaderFactory @Inject constructor(
|
|||||||
|
|
||||||
class NotLoggedInImageLoaderFactory @Inject constructor(
|
class NotLoggedInImageLoaderFactory @Inject constructor(
|
||||||
@ApplicationContext private val context: Context,
|
@ApplicationContext private val context: Context,
|
||||||
|
private val okHttpClient: OkHttpClient,
|
||||||
) : ImageLoaderFactory {
|
) : ImageLoaderFactory {
|
||||||
override fun newImageLoader(): ImageLoader {
|
override fun newImageLoader(): ImageLoader {
|
||||||
return ImageLoader
|
return ImageLoader
|
||||||
.Builder(context)
|
.Builder(context)
|
||||||
|
.okHttpClient(okHttpClient)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user