Continue setting up dagger
This commit is contained in:
parent
4452abb461
commit
b7f84f65a8
14 changed files with 177 additions and 31 deletions
|
|
@ -1,8 +1,10 @@
|
|||
package io.element.android.x.matrix
|
||||
|
||||
import android.content.Context
|
||||
import android.app.Application
|
||||
import coil.ComponentRegistry
|
||||
import io.element.android.x.core.coroutine.CoroutineDispatchers
|
||||
import io.element.android.x.di.AppScope
|
||||
import io.element.android.x.di.SingleIn
|
||||
import io.element.android.x.matrix.media.MediaFetcher
|
||||
import io.element.android.x.matrix.media.MediaKeyer
|
||||
import io.element.android.x.matrix.session.SessionStore
|
||||
|
|
@ -19,10 +21,12 @@ import timber.log.Timber
|
|||
import java.io.File
|
||||
import java.util.*
|
||||
import java.util.concurrent.Executors
|
||||
import javax.inject.Inject
|
||||
|
||||
class Matrix(
|
||||
@SingleIn(AppScope::class)
|
||||
class Matrix @Inject constructor(
|
||||
private val coroutineScope: CoroutineScope,
|
||||
context: Context,
|
||||
context: Application,
|
||||
) {
|
||||
private val coroutineDispatchers = CoroutineDispatchers(
|
||||
io = Dispatchers.IO,
|
||||
|
|
@ -58,7 +62,7 @@ class Matrix(
|
|||
return matrixClient.value.get()
|
||||
}
|
||||
|
||||
fun registerComponents(builder: ComponentRegistry.Builder) {
|
||||
fun registerCoilComponents(builder: ComponentRegistry.Builder) {
|
||||
builder.add(MediaKeyer())
|
||||
builder.add(MediaFetcher.Factory(this))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package io.element.android.x.matrix
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.app.Application
|
||||
import io.element.android.x.matrix.tracing.TracingConfigurations
|
||||
import io.element.android.x.matrix.tracing.setupTracing
|
||||
import io.element.android.x.sdk.matrix.BuildConfig
|
||||
|
|
@ -12,7 +12,7 @@ object MatrixInstance {
|
|||
@SuppressLint("StaticFieldLeak")
|
||||
private lateinit var instance: Matrix
|
||||
|
||||
fun init(context: Context, coroutineScope: CoroutineScope) {
|
||||
fun init(context: Application, coroutineScope: CoroutineScope) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
setupTracing(TracingConfigurations.debug)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue