missing suspend

This commit is contained in:
valere 2023-05-31 09:52:43 +02:00
parent 268cbb83cd
commit b59068b463
1 changed files with 3 additions and 4 deletions

View File

@ -25,7 +25,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.NonCancellable import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.cancelChildren import kotlinx.coroutines.cancelChildren
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.matrix.android.sdk.api.MatrixConfiguration import org.matrix.android.sdk.api.MatrixConfiguration
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
@ -188,8 +187,8 @@ internal class RustCryptoService @Inject constructor(
return if (longFormat) "Rust SDK $version, Vodozemac $vodozemac" else version return if (longFormat) "Rust SDK $version, Vodozemac $vodozemac" else version
} }
override fun getMyCryptoDevice(): CryptoDeviceInfo { override suspend fun getMyCryptoDevice(): CryptoDeviceInfo = withContext(coroutineDispatchers.io) {
return runBlocking { olmMachine.ownDevice() } olmMachine.ownDevice()
} }
override suspend fun fetchDevicesList(): List<DeviceInfo> { override suspend fun fetchDevicesList(): List<DeviceInfo> {
@ -341,7 +340,7 @@ internal class RustCryptoService @Inject constructor(
*/ */
override suspend fun getCryptoDeviceInfo(userId: String, deviceId: String?): CryptoDeviceInfo? { override suspend fun getCryptoDeviceInfo(userId: String, deviceId: String?): CryptoDeviceInfo? {
if (userId.isEmpty() || deviceId.isNullOrEmpty()) return null if (userId.isEmpty() || deviceId.isNullOrEmpty()) return null
return olmMachine.getCryptoDeviceInfo(userId, deviceId) return withContext(coroutineDispatchers.io) { olmMachine.getCryptoDeviceInfo(userId, deviceId) }
} }
override suspend fun getCryptoDeviceInfo(userId: String): List<CryptoDeviceInfo> { override suspend fun getCryptoDeviceInfo(userId: String): List<CryptoDeviceInfo> {