Fix / auto ready request when waiting bottomsheet on screen

This commit is contained in:
Valere 2020-01-31 09:16:03 +01:00
parent 9dde43f65b
commit 850c830e1f
2 changed files with 19 additions and 4 deletions

View File

@ -137,10 +137,6 @@ class IncomingVerificationRequestHandler @Inject constructor(private val context
(weakCurrentActivity?.get() as? VectorBaseActivity)?.let {
val roomId = pr.roomId
if (roomId.isNullOrBlank()) {
session?.getVerificationService()
?.readyPendingVerification(supportedVerificationMethods,
pr.otherUserId,
pr.transactionId ?: "")
it.navigator.waitSessionVerification(it)
} else {
it.navigator.openRoom(it, roomId, pr.transactionId)

View File

@ -100,6 +100,16 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(@Assisted ini
// See if active tx for this user and take it
session.getVerificationService().getExistingVerificationRequest(args.otherUserId)
?.firstOrNull { !it.isFinished }
?.also { verificationRequest ->
if (verificationRequest.isIncoming && !verificationRequest.isReady) {
//auto ready in this case, as we are waiting
// TODO, can I be here in DM mode? in this case should test if roomID is null?
session.getVerificationService()
.readyPendingVerification(supportedVerificationMethods,
verificationRequest.otherUserId,
verificationRequest.transactionId ?: "")
}
}
} else {
session.getVerificationService().getExistingVerificationRequest(args.otherUserId, args.verificationId)
}
@ -298,6 +308,15 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(@Assisted ini
if (state.waitForOtherUserMode && state.pendingRequest.invoke() == null && state.transactionId == null) {
// is this an incoming with that user
if (pr.isIncoming && pr.otherUserId == state.otherUserMxItem?.id) {
if (!pr.isReady) {
//auto ready in this case, as we are waiting
// TODO, can I be here in DM mode? in this case should test if roomID is null?
session.getVerificationService()
.readyPendingVerification(supportedVerificationMethods,
pr.otherUserId,
pr.transactionId ?: "")
}
// Use this one!
setState {
copy(