QrCode: WIP

This commit is contained in:
Benoit Marty 2020-01-28 11:48:36 +01:00
parent f46023e84c
commit 69ab5e43d5
4 changed files with 8 additions and 5 deletions

View File

@ -27,9 +27,9 @@ enum class CancelCode(val value: String, val humanReadable: String) {
UnexpectedMessage("m.unexpected_message", "the device received an unexpected message"),
InvalidMessage("m.invalid_message", "an invalid message was received"),
MismatchedKeys("m.key_mismatch", "Key mismatch"),
UserError("m.user_error", "User mismatch"),
UserMismatchError("m.user_mismatch", "Key mismatch"),
QrCodeInvalid("m.qr_code.invalid", "User mismatch")
UserError("m.user_error", "User error"),
MismatchedUser("m.user_mismatch", "User mismatch"),
QrCodeInvalid("m.qr_code.invalid", "Invalid QR code")
}
fun safeValueOf(code: String?): CancelCode {

View File

@ -74,7 +74,7 @@ internal class DefaultQrCodeVerificationTransaction(
}
if (otherQrCodeData.userId != otherUserId) {
cancel(CancelCode.UserMismatchError)
cancel(CancelCode.MismatchedUser)
return
}

View File

@ -156,11 +156,12 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() {
it.qrTransactionState == VerificationTxState.Verified,
it.cancelCode?.value))
})
return@withState
}
else -> Unit
}
// At this point there is no transaction for this request
// At this point there is no SAS transaction for this request
// Transaction has not yet started
if (it.pendingRequest.invoke()?.cancelConclusion != null) {

View File

@ -43,6 +43,8 @@ class VerificationConclusionViewModel(initialState: VerificationConclusionViewSt
val args = viewModelContext.args<VerificationConclusionFragment.Args>()
return when (safeValueOf(args.cancelReason)) {
CancelCode.QrCodeInvalid,
CancelCode.MismatchedUser,
CancelCode.MismatchedSas,
CancelCode.MismatchedCommitment,
CancelCode.MismatchedKeys -> {