Try using custom fetcher for Coil...

This commit is contained in:
ganfra 2022-11-21 20:15:11 +01:00
parent f9d389fe97
commit 1ba025ed30
10 changed files with 118 additions and 11 deletions

View file

@ -1,14 +1,17 @@
package io.element.android.x
import android.app.Application
import coil.ImageLoader
import coil.ImageLoaderFactory
import com.airbnb.mvrx.Mavericks
import io.element.android.x.matrix.MatrixInstance
import io.element.android.x.matrix.media.MediaFetcher
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.plus
import timber.log.Timber
class ElementXApplication : Application() {
class ElementXApplication : Application(), ImageLoaderFactory {
private val applicationScope = MainScope() + CoroutineName("ElementX Scope")
@ -18,4 +21,13 @@ class ElementXApplication : Application() {
MatrixInstance.init(this, applicationScope)
Mavericks.initialize(this)
}
override fun newImageLoader(): ImageLoader {
return ImageLoader
.Builder(this)
.components {
add(MediaFetcher.Factory(MatrixInstance.getInstance()))
}
.build()
}
}