mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-25 10:28:33 +03:00
Fix crash on on crypto store open/close
This commit is contained in:
parent
a6bc730c32
commit
58a1c80334
2 changed files with 4 additions and 11 deletions
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.matrix.android.sdk.internal.crypto
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
@ -57,7 +56,6 @@ import org.matrix.android.sdk.internal.crypto.keysbackup.tasks.StoreRoomSessionD
|
|||
import org.matrix.android.sdk.internal.crypto.keysbackup.tasks.StoreRoomSessionsDataTask
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.tasks.StoreSessionsDataTask
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.tasks.UpdateKeysBackupVersionTask
|
||||
import org.matrix.android.sdk.internal.crypto.network.RequestSender
|
||||
import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore
|
||||
import org.matrix.android.sdk.internal.crypto.store.db.RealmCryptoStore
|
||||
import org.matrix.android.sdk.internal.crypto.store.db.RealmCryptoStoreMigration
|
||||
|
@ -91,9 +89,7 @@ import org.matrix.android.sdk.internal.crypto.tasks.UploadSigningKeysTask
|
|||
import org.matrix.android.sdk.internal.crypto.verification.RustVerificationService
|
||||
import org.matrix.android.sdk.internal.database.RealmKeysUtils
|
||||
import org.matrix.android.sdk.internal.di.CryptoDatabase
|
||||
import org.matrix.android.sdk.internal.di.DeviceId
|
||||
import org.matrix.android.sdk.internal.di.SessionFilesDirectory
|
||||
import org.matrix.android.sdk.internal.di.UserId
|
||||
import org.matrix.android.sdk.internal.di.UserMd5
|
||||
import org.matrix.android.sdk.internal.session.SessionScope
|
||||
import org.matrix.android.sdk.internal.session.cache.ClearCacheTask
|
||||
|
@ -132,8 +128,8 @@ internal abstract class CryptoModule {
|
|||
@JvmStatic
|
||||
@Provides
|
||||
@SessionScope
|
||||
fun providesCryptoCoroutineScope(): CoroutineScope {
|
||||
return CoroutineScope(SupervisorJob())
|
||||
fun providesCryptoCoroutineScope(coroutineDispatchers: MatrixCoroutineDispatchers): CoroutineScope {
|
||||
return CoroutineScope(SupervisorJob() + coroutineDispatchers.crypto)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
|
|
@ -78,7 +78,6 @@ import org.matrix.android.sdk.internal.di.DeviceId
|
|||
import org.matrix.android.sdk.internal.di.UserId
|
||||
import org.matrix.android.sdk.internal.session.SessionScope
|
||||
import org.matrix.android.sdk.internal.session.StreamEventsManager
|
||||
import org.matrix.android.sdk.internal.session.room.membership.LoadRoomMembersTask
|
||||
import timber.log.Timber
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import javax.inject.Inject
|
||||
|
@ -234,6 +233,7 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
fun start() {
|
||||
internalStart()
|
||||
cryptoCoroutineScope.launch {
|
||||
cryptoStore.open()
|
||||
// Just update
|
||||
fetchDevicesList()
|
||||
cryptoStore.tidyUpDataBase()
|
||||
|
@ -264,9 +264,6 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
// Open the store
|
||||
cryptoStore.open()
|
||||
|
||||
isStarting.set(false)
|
||||
isStarted.set(true)
|
||||
}
|
||||
|
@ -277,7 +274,7 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
fun close() {
|
||||
cryptoCoroutineScope.coroutineContext.cancelChildren(CancellationException("Closing crypto module"))
|
||||
cryptoCoroutineScope.launch {
|
||||
withContext(coroutineDispatchers.crypto + NonCancellable) {
|
||||
withContext(NonCancellable) {
|
||||
cryptoStore.close()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue