mirror of
https://github.com/element-hq/element-android
synced 2024-11-25 02:45:37 +03:00
FIx / room transport was not updating state
This commit is contained in:
parent
819d7182bb
commit
be723256d3
2 changed files with 23 additions and 9 deletions
|
@ -206,7 +206,7 @@ internal class DefaultSasVerificationService @Inject constructor(
|
|||
Timber.e("## received invalid verification request")
|
||||
if (startReq.transactionID != null) {
|
||||
sasTransportRoomMessageFactory.createTransport(event.roomId
|
||||
?: "", cryptoService).cancelTransaction(
|
||||
?: "", cryptoService, null).cancelTransaction(
|
||||
startReq.transactionID ?: "",
|
||||
otherUserId!!,
|
||||
startReq.fromDevice ?: event.getSenderKey()!!,
|
||||
|
@ -218,10 +218,10 @@ internal class DefaultSasVerificationService @Inject constructor(
|
|||
|
||||
handleStart(otherUserId, startReq as VerificationInfoStart) {
|
||||
it.transport = sasTransportRoomMessageFactory.createTransport(event.roomId
|
||||
?: "", cryptoService)
|
||||
?: "", cryptoService, it)
|
||||
}?.let {
|
||||
sasTransportRoomMessageFactory.createTransport(event.roomId
|
||||
?: "", cryptoService).cancelTransaction(
|
||||
?: "", cryptoService, null).cancelTransaction(
|
||||
startReq.transactionID ?: "",
|
||||
otherUserId!!,
|
||||
startReq.fromDevice ?: event.getSenderKey()!!,
|
||||
|
@ -431,7 +431,7 @@ internal class DefaultSasVerificationService @Inject constructor(
|
|||
val otherUserId = event.senderId!!
|
||||
val existing = getExistingTransaction(otherUserId, keyReq.transactionID!!)
|
||||
if (existing == null) {
|
||||
Timber.e("## SAS Received invalid accept request")
|
||||
Timber.e("## SAS Received invalid key request")
|
||||
return
|
||||
}
|
||||
if (existing is SASVerificationTransaction) {
|
||||
|
@ -572,7 +572,7 @@ internal class DefaultSasVerificationService @Inject constructor(
|
|||
transactionId,
|
||||
otherUserId,
|
||||
otherDeviceId)
|
||||
tx.transport = sasTransportRoomMessageFactory.createTransport(roomId, cryptoService)
|
||||
tx.transport = sasTransportRoomMessageFactory.createTransport(roomId, cryptoService, tx)
|
||||
addTransaction(tx)
|
||||
|
||||
tx.start()
|
||||
|
|
|
@ -36,7 +36,7 @@ import javax.inject.Inject
|
|||
internal class SasTransportRoomMessage(
|
||||
private val roomId: String,
|
||||
private val cryptoService: CryptoService,
|
||||
// private val tx: SASVerificationTransaction?,
|
||||
private val tx: SASVerificationTransaction?,
|
||||
private val sendVerificationMessageTask: SendVerificationMessageTask,
|
||||
private val taskExecutor: TaskExecutor
|
||||
) : SasTransport {
|
||||
|
@ -57,6 +57,20 @@ internal class SasTransportRoomMessage(
|
|||
)
|
||||
) {
|
||||
constraints = TaskConstraints(true)
|
||||
callback = object : MatrixCallback<SendResponse> {
|
||||
override fun onSuccess(data: SendResponse) {
|
||||
if (onDone != null) {
|
||||
onDone()
|
||||
} else {
|
||||
tx?.state = nextState
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(failure: Throwable) {
|
||||
Timber.e("## SAS verification [${tx?.transactionId}] failed to send toDevice in state : ${tx?.state}")
|
||||
tx?.cancel(onErrorReason)
|
||||
}
|
||||
}
|
||||
retryCount = 3
|
||||
}
|
||||
.executeBy(taskExecutor)
|
||||
|
@ -153,9 +167,9 @@ internal class SasTransportRoomMessageFactory @Inject constructor(
|
|||
private val taskExecutor: TaskExecutor) {
|
||||
|
||||
fun createTransport(roomId: String,
|
||||
cryptoService: CryptoService
|
||||
// tx: SASVerificationTransaction?
|
||||
cryptoService: CryptoService,
|
||||
tx: SASVerificationTransaction?
|
||||
): SasTransportRoomMessage {
|
||||
return SasTransportRoomMessage(roomId, cryptoService, /*tx,*/ sendVerificationMessageTask, taskExecutor)
|
||||
return SasTransportRoomMessage(roomId, cryptoService, tx, sendVerificationMessageTask, taskExecutor)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue