Display specific message when verif code malformed

This commit is contained in:
Valere 2022-06-28 12:17:18 +02:00
parent 69920a6e46
commit 86b888c336
4 changed files with 15 additions and 3 deletions

View File

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

View File

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

View File

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

View File

@ -2361,6 +2361,7 @@
</string> </string>
<string name="verify_cancelled_notice">Verification has been cancelled. You can start verification again.</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="verification_cancelled">Verification Cancelled</string>
<string name="recovery_passphrase">Recovery Passphrase</string> <string name="recovery_passphrase">Recovery Passphrase</string>