From 8b39eabc0fae60f7f7fa16ea6bbd09d064068688 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Mon, 8 Feb 2021 17:26:09 +0300 Subject: [PATCH] Code review fixes. --- .../sdk/internal/crypto/DefaultCryptoService.kt | 14 +++++++------- vector/build.gradle | 2 +- .../OutboundSessionKeySharingStrategy.kt | 2 +- .../home/room/detail/RoomDetailViewModel.kt | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) rename {matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/crypto => vector/src/main/java/im/vector/app/features/crypto/keysrequest}/OutboundSessionKeySharingStrategy.kt (95%) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt index 1a90377664..14542a1ea8 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt @@ -1298,14 +1298,14 @@ internal class DefaultCryptoService @Inject constructor( } override fun ensureOutboundSession(roomId: String) { - // Ensure to load all room members - loadRoomMembersTask - .configureWith(LoadRoomMembersTask.Params(roomId)) { - this.callback = NoOpMatrixCallback() - } - .executeBy(taskExecutor) - cryptoCoroutineScope.launch(coroutineDispatchers.crypto) { + // Ensure to load all room members + loadRoomMembersTask + .configureWith(LoadRoomMembersTask.Params(roomId)) { + this.callback = NoOpMatrixCallback() + } + .executeBy(taskExecutor) + val userIds = getRoomUserIds(roomId) val alg = roomEncryptorsStore.get(roomId) ?: getEncryptionAlgorithm(roomId) diff --git a/vector/build.gradle b/vector/build.gradle index c539ebb648..dc2a16ccc5 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -136,7 +136,7 @@ android { buildConfigField "String", "BUILD_NUMBER", "\"${buildNumber}\"" resValue "string", "build_number", "\"${buildNumber}\"" - buildConfigField "org.matrix.android.sdk.api.crypto.OutboundSessionKeySharingStrategy", "outboundSessionKeySharingStrategy", "org.matrix.android.sdk.api.crypto.OutboundSessionKeySharingStrategy.WhenTyping" + buildConfigField "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy", "outboundSessionKeySharingStrategy", "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy.WhenTyping" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/crypto/OutboundSessionKeySharingStrategy.kt b/vector/src/main/java/im/vector/app/features/crypto/keysrequest/OutboundSessionKeySharingStrategy.kt similarity index 95% rename from matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/crypto/OutboundSessionKeySharingStrategy.kt rename to vector/src/main/java/im/vector/app/features/crypto/keysrequest/OutboundSessionKeySharingStrategy.kt index 9ef1f538b8..e797f4622c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/crypto/OutboundSessionKeySharingStrategy.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysrequest/OutboundSessionKeySharingStrategy.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.matrix.android.sdk.api.crypto +package im.vector.app.features.crypto.keysrequest enum class OutboundSessionKeySharingStrategy { /** diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt index 099f2eefff..ea5787de46 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt @@ -61,7 +61,7 @@ import org.commonmark.renderer.html.HtmlRenderer import org.matrix.android.sdk.api.MatrixCallback import org.matrix.android.sdk.api.MatrixPatterns import org.matrix.android.sdk.api.NoOpMatrixCallback -import org.matrix.android.sdk.api.crypto.OutboundSessionKeySharingStrategy +import im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy import org.matrix.android.sdk.api.extensions.tryOrNull import org.matrix.android.sdk.api.query.QueryStringValue import org.matrix.android.sdk.api.raw.RawService @@ -599,7 +599,7 @@ class RoomDetailViewModel @AssistedInject constructor( } } // Ensure outbound session keys - if (room.isEncrypted() && BuildConfig.outboundSessionKeySharingStrategy == OutboundSessionKeySharingStrategy.WhenTyping) { + if (action.isTyping && room.isEncrypted() && BuildConfig.outboundSessionKeySharingStrategy == OutboundSessionKeySharingStrategy.WhenTyping) { room.ensureOutboundSession() } }