mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 12:00:03 +03:00
Dagger: don't create MatrixCoroutineDispatchers multiple time!!
This commit is contained in:
parent
ef597cc67a
commit
eefd09d022
1 changed files with 5 additions and 7 deletions
|
@ -23,6 +23,7 @@ import android.os.HandlerThread
|
|||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import im.vector.matrix.android.internal.util.MatrixCoroutineDispatchers
|
||||
import im.vector.matrix.android.internal.util.createBackgroundHandler
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.android.asCoroutineDispatcher
|
||||
import org.matrix.olm.OlmManager
|
||||
|
@ -32,15 +33,12 @@ internal object MatrixModule {
|
|||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@MatrixScope
|
||||
fun providesMatrixCoroutineDispatchers(): MatrixCoroutineDispatchers {
|
||||
val THREAD_CRYPTO_NAME = "Crypto_Thread"
|
||||
val handlerThread = HandlerThread(THREAD_CRYPTO_NAME)
|
||||
handlerThread.start()
|
||||
|
||||
return MatrixCoroutineDispatchers(io = Dispatchers.IO,
|
||||
computation = Dispatchers.IO,
|
||||
main = Dispatchers.Main,
|
||||
crypto = Handler(handlerThread.looper).asCoroutineDispatcher("crypto")
|
||||
computation = Dispatchers.IO,
|
||||
main = Dispatchers.Main,
|
||||
crypto = createBackgroundHandler("Crypto_Thread").asCoroutineDispatcher()
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue