diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultSasVerificationService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultSasVerificationService.kt index 1b909c11aa..d8a98ff280 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultSasVerificationService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultSasVerificationService.kt @@ -41,6 +41,7 @@ import im.vector.matrix.android.internal.session.SessionScope import im.vector.matrix.android.internal.util.MatrixCoroutineDispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch +import okhttp3.internal.toImmutableList import timber.log.Timber import java.util.* import javax.inject.Inject @@ -726,10 +727,11 @@ internal class DefaultSasVerificationService @Inject constructor( val transport = sasTransportRoomMessageFactory.createTransport(roomId, null) // Cancel existing pending requests? - requestsForUser.forEach { existingRequest -> + requestsForUser.toImmutableList().forEach { existingRequest -> existingRequest.transactionId?.let { tid -> if (!existingRequest.isFinished) { Timber.d("## SAS, cancelling pending requests to start a new one") + updatePendingRequest(existingRequest.copy(cancelConclusion = CancelCode.User)) transport.cancelTransaction(tid, existingRequest.otherUserId, "", CancelCode.User) } } diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheet.kt b/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheet.kt index 14c32efc27..bd7c280295 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheet.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheet.kt @@ -131,7 +131,9 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() { showFragment(VerificationEmojiCodeFragment::class, Bundle().apply { putParcelable(MvRx.KEY_ARG, VerificationArgs( it.otherUserMxItem?.id ?: "", - it.transactionId)) + // If it was outgoing it.transaction id would be null, but the pending request + // would be updated (from localID to txId) + it.pendingRequest?.transactionId ?: it.transactionId)) }) } SasVerificationTxState.Verified, diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/TimelineItemFactory.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/TimelineItemFactory.kt index 4704a3de85..acaf48ea56 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/TimelineItemFactory.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/TimelineItemFactory.kt @@ -20,6 +20,7 @@ import im.vector.matrix.android.api.session.events.model.EventType import im.vector.matrix.android.api.session.room.timeline.TimelineEvent import im.vector.riotx.core.epoxy.EmptyItem_ import im.vector.riotx.core.epoxy.VectorEpoxyModel +import im.vector.riotx.core.resources.UserPreferencesProvider import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController import timber.log.Timber import javax.inject.Inject @@ -29,7 +30,8 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me private val noticeItemFactory: NoticeItemFactory, private val defaultItemFactory: DefaultItemFactory, private val roomCreateItemFactory: RoomCreateItemFactory, - private val verificationConclusionItemFactory: VerificationItemFactory) { + private val verificationConclusionItemFactory: VerificationItemFactory, + private val userPreferencesProvider: UserPreferencesProvider ) { fun create(event: TimelineEvent, nextEvent: TimelineEvent?, @@ -73,9 +75,11 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me EventType.KEY_VERIFICATION_KEY, EventType.KEY_VERIFICATION_READY, EventType.KEY_VERIFICATION_MAC -> { - // These events are filtered from timeline in normal case - // Only visible in developer mode - noticeItemFactory.create(event, highlight, callback) + // TODO These are not filtered out by timeline when encrypted + // For now manually ignore + if (userPreferencesProvider.shouldShowHiddenEvents()) { + noticeItemFactory.create(event, highlight, callback) + } else null } EventType.KEY_VERIFICATION_CANCEL, EventType.KEY_VERIFICATION_DONE -> {