Fix / Unknown transaction when started by other after request
This commit is contained in:
parent
e8a4f1fb90
commit
65cb812fc6
|
@ -41,6 +41,7 @@ import im.vector.matrix.android.internal.session.SessionScope
|
||||||
import im.vector.matrix.android.internal.util.MatrixCoroutineDispatchers
|
import im.vector.matrix.android.internal.util.MatrixCoroutineDispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import okhttp3.internal.toImmutableList
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -726,10 +727,11 @@ internal class DefaultSasVerificationService @Inject constructor(
|
||||||
val transport = sasTransportRoomMessageFactory.createTransport(roomId, null)
|
val transport = sasTransportRoomMessageFactory.createTransport(roomId, null)
|
||||||
|
|
||||||
// Cancel existing pending requests?
|
// Cancel existing pending requests?
|
||||||
requestsForUser.forEach { existingRequest ->
|
requestsForUser.toImmutableList().forEach { existingRequest ->
|
||||||
existingRequest.transactionId?.let { tid ->
|
existingRequest.transactionId?.let { tid ->
|
||||||
if (!existingRequest.isFinished) {
|
if (!existingRequest.isFinished) {
|
||||||
Timber.d("## SAS, cancelling pending requests to start a new one")
|
Timber.d("## SAS, cancelling pending requests to start a new one")
|
||||||
|
updatePendingRequest(existingRequest.copy(cancelConclusion = CancelCode.User))
|
||||||
transport.cancelTransaction(tid, existingRequest.otherUserId, "", CancelCode.User)
|
transport.cancelTransaction(tid, existingRequest.otherUserId, "", CancelCode.User)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,9 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() {
|
||||||
showFragment(VerificationEmojiCodeFragment::class, Bundle().apply {
|
showFragment(VerificationEmojiCodeFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationArgs(
|
putParcelable(MvRx.KEY_ARG, VerificationArgs(
|
||||||
it.otherUserMxItem?.id ?: "",
|
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,
|
SasVerificationTxState.Verified,
|
||||||
|
|
|
@ -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.matrix.android.api.session.room.timeline.TimelineEvent
|
||||||
import im.vector.riotx.core.epoxy.EmptyItem_
|
import im.vector.riotx.core.epoxy.EmptyItem_
|
||||||
import im.vector.riotx.core.epoxy.VectorEpoxyModel
|
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 im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -29,7 +30,8 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me
|
||||||
private val noticeItemFactory: NoticeItemFactory,
|
private val noticeItemFactory: NoticeItemFactory,
|
||||||
private val defaultItemFactory: DefaultItemFactory,
|
private val defaultItemFactory: DefaultItemFactory,
|
||||||
private val roomCreateItemFactory: RoomCreateItemFactory,
|
private val roomCreateItemFactory: RoomCreateItemFactory,
|
||||||
private val verificationConclusionItemFactory: VerificationItemFactory) {
|
private val verificationConclusionItemFactory: VerificationItemFactory,
|
||||||
|
private val userPreferencesProvider: UserPreferencesProvider ) {
|
||||||
|
|
||||||
fun create(event: TimelineEvent,
|
fun create(event: TimelineEvent,
|
||||||
nextEvent: TimelineEvent?,
|
nextEvent: TimelineEvent?,
|
||||||
|
@ -73,9 +75,11 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me
|
||||||
EventType.KEY_VERIFICATION_KEY,
|
EventType.KEY_VERIFICATION_KEY,
|
||||||
EventType.KEY_VERIFICATION_READY,
|
EventType.KEY_VERIFICATION_READY,
|
||||||
EventType.KEY_VERIFICATION_MAC -> {
|
EventType.KEY_VERIFICATION_MAC -> {
|
||||||
// These events are filtered from timeline in normal case
|
// TODO These are not filtered out by timeline when encrypted
|
||||||
// Only visible in developer mode
|
// For now manually ignore
|
||||||
|
if (userPreferencesProvider.shouldShowHiddenEvents()) {
|
||||||
noticeItemFactory.create(event, highlight, callback)
|
noticeItemFactory.create(event, highlight, callback)
|
||||||
|
} else null
|
||||||
}
|
}
|
||||||
EventType.KEY_VERIFICATION_CANCEL,
|
EventType.KEY_VERIFICATION_CANCEL,
|
||||||
EventType.KEY_VERIFICATION_DONE -> {
|
EventType.KEY_VERIFICATION_DONE -> {
|
||||||
|
|
Loading…
Reference in New Issue