Create asValidObject method - make it works
This commit is contained in:
parent
e326631752
commit
0828f9270e
@ -33,11 +33,10 @@ data class MessageVerificationRequestContent(
|
||||
@Json(name = "format") val format: String? = null,
|
||||
@Json(name = "formatted_body") val formattedBody: String? = null,
|
||||
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
|
||||
@Json(name = "m.new_content") override val newContent: Content? = null
|
||||
@Json(name = "m.new_content") override val newContent: Content? = null,
|
||||
// Not parsed, but set after, using the eventId
|
||||
override val transactionID: String? = null
|
||||
) : MessageContent, VerificationInfoRequest {
|
||||
|
||||
override val transactionID: String?
|
||||
get() = relatesTo?.eventId
|
||||
|
||||
override fun toEventContent() = toContent()
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ internal data class KeyVerificationRequest(
|
||||
@Json(name = "methods") override val methods: List<String>,
|
||||
@Json(name = "timestamp") override val timestamp: Long?,
|
||||
@Json(name = "transaction_id") override val transactionID: String? = null
|
||||
|
||||
) : SendToDeviceObject, VerificationInfoRequest {
|
||||
|
||||
override fun toSendToDeviceObject() = this
|
||||
|
@ -20,13 +20,13 @@ import android.os.Handler
|
||||
import android.os.Looper
|
||||
import dagger.Lazy
|
||||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.session.crypto.verification.PendingVerificationRequest
|
||||
import im.vector.matrix.android.api.session.crypto.verification.ValidVerificationInfoReady
|
||||
import im.vector.matrix.android.api.session.crypto.CryptoService
|
||||
import im.vector.matrix.android.api.session.crypto.crosssigning.CrossSigningService
|
||||
import im.vector.matrix.android.api.session.crypto.verification.CancelCode
|
||||
import im.vector.matrix.android.api.session.crypto.verification.PendingVerificationRequest
|
||||
import im.vector.matrix.android.api.session.crypto.verification.QrCodeVerificationTransaction
|
||||
import im.vector.matrix.android.api.session.crypto.verification.SasVerificationTransaction
|
||||
import im.vector.matrix.android.api.session.crypto.verification.ValidVerificationInfoReady
|
||||
import im.vector.matrix.android.api.session.crypto.verification.VerificationMethod
|
||||
import im.vector.matrix.android.api.session.crypto.verification.VerificationService
|
||||
import im.vector.matrix.android.api.session.crypto.verification.VerificationTransaction
|
||||
@ -311,7 +311,10 @@ internal class DefaultVerificationService @Inject constructor(
|
||||
suspend fun onRoomRequestReceived(event: Event) {
|
||||
Timber.v("## SAS Verification request from ${event.senderId} in room ${event.roomId}")
|
||||
val requestInfo = event.getClearContent().toModel<MessageVerificationRequestContent>() ?: return
|
||||
val validRequestInfo = requestInfo.asValidObject() ?: return
|
||||
val validRequestInfo = requestInfo
|
||||
// copy the EventId to the transactionId
|
||||
.copy(transactionID = event.eventId)
|
||||
.asValidObject() ?: return
|
||||
|
||||
val senderId = event.senderId ?: return
|
||||
|
||||
@ -562,7 +565,7 @@ internal class DefaultVerificationService @Inject constructor(
|
||||
}
|
||||
|
||||
private fun handleOnCancel(otherUserId: String, cancelReq: ValidVerificationInfoCancel) {
|
||||
Timber.v("## SAS onCancelReceived otherUser:$otherUserId reason:${cancelReq.reason}")
|
||||
Timber.v("## SAS onCancelReceived otherUser: $otherUserId reason: ${cancelReq.reason}")
|
||||
|
||||
val existingTransaction = getExistingTransaction(otherUserId, cancelReq.transactionID)
|
||||
val existingRequest = getExistingVerificationRequest(otherUserId, cancelReq.transactionID)
|
||||
|
Loading…
x
Reference in New Issue
Block a user