Merge pull request #6395 from vector-im/feature/bca/fix_invalid_qr_warning

Display specific message when verif code malformed
This commit is contained in:
Valere 2022-07-21 12:36:46 +02:00 committed by GitHub
commit fb05ab34d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 3 deletions

1
changelog.d/6395.bugfix Normal file
View file

@ -0,0 +1 @@
Display specific message when verification QR code is malformed

View file

@ -84,7 +84,7 @@ internal class DefaultQrCodeVerificationTransaction(
// Perform some checks
if (otherQrCodeData.transactionId != transactionId) {
Timber.d("## Verification QR: Invalid transaction actual ${otherQrCodeData.transactionId} expected:$transactionId")
cancel(CancelCode.QrCodeInvalid)
cancel(CancelCode.UnknownTransaction)
return
}

View file

@ -86,6 +86,14 @@ class VerificationConclusionController @Inject constructor(
bottomGotIt()
}
ConclusionState.INVALID_QR_CODE -> {
bottomSheetVerificationNoticeItem {
id("invalid_qr")
notice(host.stringProvider.getString(R.string.verify_invalid_qr_notice).toEpoxyCharSequence())
}
bottomGotIt()
}
ConclusionState.CANCELLED -> {
bottomSheetVerificationNoticeItem {
id("notice_cancelled")

View file

@ -32,7 +32,8 @@ data class VerificationConclusionViewState(
enum class ConclusionState {
SUCCESS,
WARNING,
CANCELLED
CANCELLED,
INVALID_QR_CODE
}
class VerificationConclusionViewModel(initialState: VerificationConclusionViewState) :
@ -44,7 +45,9 @@ class VerificationConclusionViewModel(initialState: VerificationConclusionViewSt
val args = viewModelContext.args<VerificationConclusionFragment.Args>()
return when (safeValueOf(args.cancelReason)) {
CancelCode.QrCodeInvalid,
CancelCode.QrCodeInvalid -> {
VerificationConclusionViewState(ConclusionState.INVALID_QR_CODE, args.isMe)
}
CancelCode.MismatchedUser,
CancelCode.MismatchedSas,
CancelCode.MismatchedCommitment,

View file

@ -2436,6 +2436,7 @@
</string>
<string name="verify_cancelled_notice">Verification has been cancelled. You can start verification again.</string>
<string name="verify_invalid_qr_notice">This QR code looks malformed. Please try to verify with another method.</string>
<string name="verification_cancelled">Verification Cancelled</string>
<string name="recovery_passphrase">Recovery Passphrase</string>