Skip to content

Commit

Permalink
fix: use correct result strings in double scan mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nicola-95 authored Mar 7, 2022
1 parent 22d7107 commit e766976
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,8 @@ class VerificationFragment : Fragment(), View.OnClickListener {
if (it.isANonValidCertificate()) {
addDoubleScanResult(R.drawable.ic_invalid, R.string.certificateTestNotValid)
setValidationLayout(CertificateStatus.NOT_VALID)
viewModel.setDoubleScanFlag(false)
} else if (it == CertificateStatus.VALID) {
addDoubleScanResult(R.drawable.ic_valid_cert, R.string.certificateTestValid)
viewModel.setDoubleScanFlag(false)
if (viewModel.getUserName() != userName) {
addDoubleScanResult(R.drawable.ic_invalid, R.string.userDataDoesNotMatch)
setValidationLayout(CertificateStatus.NOT_VALID)
Expand Down Expand Up @@ -277,16 +275,18 @@ class VerificationFragment : Fragment(), View.OnClickListener {
}

private fun setValidationMainText(certStatus: CertificateStatus) {
val isDoubleScanFlow = viewModel.getDoubleScanFlag()
val validTitle = if (isDoubleScanFlow) getString(R.string.certificateTestValidTitle) else getString(R.string.certificateValid)
val notValidTitle = if (isDoubleScanFlow) getString(R.string.certificateTestNonValidTitle) else getString(R.string.certificateNonValid)

binding.certificateValid.text = when (certStatus) {
CertificateStatus.VALID -> getString(R.string.certificateValid)
CertificateStatus.VALID -> validTitle
CertificateStatus.NOT_EU_DCC -> getString(R.string.certificateNotDCC)
CertificateStatus.REVOKED -> if (isDebug()) getString(R.string.certificateRevoked) else getString(
R.string.certificateNonValid
)
CertificateStatus.NOT_VALID -> getString(R.string.certificateNonValid)
CertificateStatus.EXPIRED -> getString(R.string.certificateExpired)
CertificateStatus.REVOKED -> if (isDebug()) getString(R.string.certificateRevoked) else notValidTitle
CertificateStatus.NOT_VALID -> notValidTitle
CertificateStatus.EXPIRED -> if (isDoubleScanFlow) notValidTitle else getString(R.string.certificateExpired)
CertificateStatus.TEST_NEEDED -> getString(R.string.certificateValidTestNeeded)
CertificateStatus.NOT_VALID_YET -> getString(R.string.certificateNonValidYet)
CertificateStatus.NOT_VALID_YET -> if (isDoubleScanFlow) notValidTitle else getString(R.string.certificateNonValidYet)
}
}

Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
<string name="privacyPolicy"><u>Leggi la Privacy policy</u></string>
<string name="codiceFiscale">Codice fiscale</string>
<string name="expirationText">Data scadenza certificato</string>
<string name="certificateValid">Verifica valida</string>
<string name="certificateNonValid">Verifica non valida</string>
<string name="certificateValid">Certificazione valida</string>
<string name="certificateNonValid">Certificazione non valida</string>
<string name="certificateTestValidTitle">Verifica valida</string>
<string name="certificateTestNonValidTitle">Verifica non valida</string>
<string name="certificateExpired">Certificazione scaduta</string>
<string name="certificateRevoked">Certificazione revocata</string>
<string name="certificateNonValidYet">Certificazione non ancora valida</string>
Expand Down

0 comments on commit e766976

Please sign in to comment.