Create matrixui module and remove dependency to coil in the matrix module. Move MatrixUser there.
This commit is contained in:
parent
4431f037ab
commit
c5c05e3867
17 changed files with 106 additions and 24 deletions
|
|
@ -18,11 +18,13 @@ package io.element.android.x.di
|
|||
|
||||
import com.squareup.anvil.annotations.ContributesTo
|
||||
import io.element.android.x.matrix.Matrix
|
||||
import io.element.android.x.matrix.ui.MatrixUi
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
interface AppBindings {
|
||||
fun coroutineScope(): CoroutineScope
|
||||
fun matrix(): Matrix
|
||||
fun matrixUi(): MatrixUi
|
||||
fun sessionComponentsOwner(): SessionComponentsOwner
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,19 +35,18 @@ class CoilInitializer : Initializer<Unit> {
|
|||
|
||||
private class ElementImageLoaderFactory(
|
||||
private val context: Context
|
||||
) :
|
||||
ImageLoaderFactory {
|
||||
) : ImageLoaderFactory {
|
||||
override fun newImageLoader(): ImageLoader {
|
||||
return ImageLoader
|
||||
.Builder(context)
|
||||
.components {
|
||||
val appBindings = context.bindings<AppBindings>()
|
||||
val matrix = appBindings.matrix()
|
||||
val matrixUi = appBindings.matrixUi()
|
||||
val matrixClientProvider = {
|
||||
appBindings
|
||||
.sessionComponentsOwner().activeSessionComponent?.matrixClient()
|
||||
}
|
||||
matrix.registerCoilComponents(this, matrixClientProvider)
|
||||
matrixUi.registerCoilComponents(this, matrixClientProvider)
|
||||
}
|
||||
.build()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue