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 { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let {
val roomId = pr.roomId val roomId = pr.roomId
if (roomId.isNullOrBlank()) { if (roomId.isNullOrBlank()) {
session?.getVerificationService()
?.readyPendingVerification(supportedVerificationMethods,
pr.otherUserId,
pr.transactionId ?: "")
it.navigator.waitSessionVerification(it) it.navigator.waitSessionVerification(it)
} else { } else {
it.navigator.openRoom(it, roomId, pr.transactionId) 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 // See if active tx for this user and take it
session.getVerificationService().getExistingVerificationRequest(args.otherUserId) session.getVerificationService().getExistingVerificationRequest(args.otherUserId)
?.firstOrNull { !it.isFinished } ?.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 { } else {
session.getVerificationService().getExistingVerificationRequest(args.otherUserId, args.verificationId) 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) { if (state.waitForOtherUserMode && state.pendingRequest.invoke() == null && state.transactionId == null) {
// is this an incoming with that user // is this an incoming with that user
if (pr.isIncoming && pr.otherUserId == state.otherUserMxItem?.id) { 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! // Use this one!
setState { setState {
copy( copy(