mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Fix / auto ready request when waiting bottomsheet on screen
This commit is contained in:
parent
9dde43f65b
commit
850c830e1f
2 changed files with 19 additions and 4 deletions
|
@ -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)
|
||||||
|
|
|
@ -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(
|
||||||
|
|
Loading…
Reference in a new issue