mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-07 23:58:40 +01:00
FIx / room transport was not updating state
This commit is contained in:
parent
819d7182bb
commit
be723256d3
@ -206,7 +206,7 @@ internal class DefaultSasVerificationService @Inject constructor(
|
|||||||
Timber.e("## received invalid verification request")
|
Timber.e("## received invalid verification request")
|
||||||
if (startReq.transactionID != null) {
|
if (startReq.transactionID != null) {
|
||||||
sasTransportRoomMessageFactory.createTransport(event.roomId
|
sasTransportRoomMessageFactory.createTransport(event.roomId
|
||||||
?: "", cryptoService).cancelTransaction(
|
?: "", cryptoService, null).cancelTransaction(
|
||||||
startReq.transactionID ?: "",
|
startReq.transactionID ?: "",
|
||||||
otherUserId!!,
|
otherUserId!!,
|
||||||
startReq.fromDevice ?: event.getSenderKey()!!,
|
startReq.fromDevice ?: event.getSenderKey()!!,
|
||||||
@ -218,10 +218,10 @@ internal class DefaultSasVerificationService @Inject constructor(
|
|||||||
|
|
||||||
handleStart(otherUserId, startReq as VerificationInfoStart) {
|
handleStart(otherUserId, startReq as VerificationInfoStart) {
|
||||||
it.transport = sasTransportRoomMessageFactory.createTransport(event.roomId
|
it.transport = sasTransportRoomMessageFactory.createTransport(event.roomId
|
||||||
?: "", cryptoService)
|
?: "", cryptoService, it)
|
||||||
}?.let {
|
}?.let {
|
||||||
sasTransportRoomMessageFactory.createTransport(event.roomId
|
sasTransportRoomMessageFactory.createTransport(event.roomId
|
||||||
?: "", cryptoService).cancelTransaction(
|
?: "", cryptoService, null).cancelTransaction(
|
||||||
startReq.transactionID ?: "",
|
startReq.transactionID ?: "",
|
||||||
otherUserId!!,
|
otherUserId!!,
|
||||||
startReq.fromDevice ?: event.getSenderKey()!!,
|
startReq.fromDevice ?: event.getSenderKey()!!,
|
||||||
@ -431,7 +431,7 @@ internal class DefaultSasVerificationService @Inject constructor(
|
|||||||
val otherUserId = event.senderId!!
|
val otherUserId = event.senderId!!
|
||||||
val existing = getExistingTransaction(otherUserId, keyReq.transactionID!!)
|
val existing = getExistingTransaction(otherUserId, keyReq.transactionID!!)
|
||||||
if (existing == null) {
|
if (existing == null) {
|
||||||
Timber.e("## SAS Received invalid accept request")
|
Timber.e("## SAS Received invalid key request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (existing is SASVerificationTransaction) {
|
if (existing is SASVerificationTransaction) {
|
||||||
@ -572,7 +572,7 @@ internal class DefaultSasVerificationService @Inject constructor(
|
|||||||
transactionId,
|
transactionId,
|
||||||
otherUserId,
|
otherUserId,
|
||||||
otherDeviceId)
|
otherDeviceId)
|
||||||
tx.transport = sasTransportRoomMessageFactory.createTransport(roomId, cryptoService)
|
tx.transport = sasTransportRoomMessageFactory.createTransport(roomId, cryptoService, tx)
|
||||||
addTransaction(tx)
|
addTransaction(tx)
|
||||||
|
|
||||||
tx.start()
|
tx.start()
|
||||||
|
@ -36,7 +36,7 @@ import javax.inject.Inject
|
|||||||
internal class SasTransportRoomMessage(
|
internal class SasTransportRoomMessage(
|
||||||
private val roomId: String,
|
private val roomId: String,
|
||||||
private val cryptoService: CryptoService,
|
private val cryptoService: CryptoService,
|
||||||
// private val tx: SASVerificationTransaction?,
|
private val tx: SASVerificationTransaction?,
|
||||||
private val sendVerificationMessageTask: SendVerificationMessageTask,
|
private val sendVerificationMessageTask: SendVerificationMessageTask,
|
||||||
private val taskExecutor: TaskExecutor
|
private val taskExecutor: TaskExecutor
|
||||||
) : SasTransport {
|
) : SasTransport {
|
||||||
@ -57,6 +57,20 @@ internal class SasTransportRoomMessage(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
constraints = TaskConstraints(true)
|
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
|
retryCount = 3
|
||||||
}
|
}
|
||||||
.executeBy(taskExecutor)
|
.executeBy(taskExecutor)
|
||||||
@ -153,9 +167,9 @@ internal class SasTransportRoomMessageFactory @Inject constructor(
|
|||||||
private val taskExecutor: TaskExecutor) {
|
private val taskExecutor: TaskExecutor) {
|
||||||
|
|
||||||
fun createTransport(roomId: String,
|
fun createTransport(roomId: String,
|
||||||
cryptoService: CryptoService
|
cryptoService: CryptoService,
|
||||||
// tx: SASVerificationTransaction?
|
tx: SASVerificationTransaction?
|
||||||
): SasTransportRoomMessage {
|
): SasTransportRoomMessage {
|
||||||
return SasTransportRoomMessage(roomId, cryptoService, /*tx,*/ sendVerificationMessageTask, taskExecutor)
|
return SasTransportRoomMessage(roomId, cryptoService, tx, sendVerificationMessageTask, taskExecutor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user