Skip to content

Commit

Permalink
Merge pull request #219 from ministero-salute/feature/single-valid-st…
Browse files Browse the repository at this point in the history
…atus-ui

feature: unify valid statuses
  • Loading branch information
astagi authored Dec 15, 2021
2 parents e3396ff + 0ca3abc commit 5441838
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ class VerificationFragment : Fragment(), View.OnClickListener {
setPersonData(it.person, it.dateOfBirth)
setupCertStatusView(it)
setupTimeStamp(it)
if (viewModel.getTotemMode() && (certificate.certificateStatus == CertificateStatus.VALID
|| certificate.certificateStatus == CertificateStatus.PARTIALLY_VALID)
if (
viewModel.getTotemMode() &&
(certificate.certificateStatus == CertificateStatus.VALID)
) {
Handler().postDelayed({
activity?.onBackPressed()
Expand Down Expand Up @@ -144,7 +145,7 @@ class VerificationFragment : Fragment(), View.OnClickListener {
private fun setLinkViews(certStatus: CertificateStatus) {
binding.questionContainer.removeAllViews()
val questionMap: Map<String, String> = when (certStatus) {
CertificateStatus.VALID, CertificateStatus.PARTIALLY_VALID -> mapOf(getString(R.string.label_what_can_be_done) to "https://www.dgc.gov.it/web/faq.html#verifica19")
CertificateStatus.VALID -> mapOf(getString(R.string.label_what_can_be_done) to "https://www.dgc.gov.it/web/faq.html#verifica19")
CertificateStatus.NOT_VALID_YET -> mapOf(getString(R.string.label_when_qr_valid) to "https://www.dgc.gov.it/web/faq.html#verifica19")
CertificateStatus.NOT_VALID -> mapOf(getString(R.string.label_why_qr_not_valid) to "https://www.dgc.gov.it/web/faq.html#verifica19")
CertificateStatus.NOT_EU_DCC -> mapOf(getString(R.string.label_which_qr_scan) to "https://www.dgc.gov.it/web/faq.html#verifica19")
Expand All @@ -167,7 +168,7 @@ class VerificationFragment : Fragment(), View.OnClickListener {
private fun setValidationSubText(certStatus: CertificateStatus) {
binding.subtitleText.text =
when (certStatus) {
CertificateStatus.VALID, CertificateStatus.PARTIALLY_VALID -> getString(R.string.subtitle_text)
CertificateStatus.VALID -> getString(R.string.subtitle_text)
CertificateStatus.NOT_VALID, CertificateStatus.NOT_VALID_YET -> getString(R.string.subtitle_text_notvalid)
else -> getString(R.string.subtitle_text_technicalError)
}
Expand All @@ -176,7 +177,6 @@ class VerificationFragment : Fragment(), View.OnClickListener {
private fun setValidationMainText(certStatus: CertificateStatus) {
binding.certificateValid.text = when (certStatus) {
CertificateStatus.VALID -> getString(R.string.certificateValid)
CertificateStatus.PARTIALLY_VALID -> getString(R.string.certificatePartiallyValid)
CertificateStatus.NOT_EU_DCC -> getString(R.string.certificateNotDCC)
CertificateStatus.NOT_VALID -> {
if (VerificaApplication.isCertificateRevoked && BuildConfig.BUILD_TYPE == "debug") {
Expand All @@ -196,7 +196,6 @@ class VerificationFragment : Fragment(), View.OnClickListener {
requireContext(), when (certStatus) {
CertificateStatus.VALID -> R.drawable.ic_valid_cert
CertificateStatus.NOT_VALID_YET -> R.drawable.ic_not_valid_yet
CertificateStatus.PARTIALLY_VALID -> R.drawable.ic_valid_cert
CertificateStatus.NOT_EU_DCC -> R.drawable.ic_technical_error
else -> R.drawable.ic_invalid
}
Expand All @@ -205,7 +204,7 @@ class VerificationFragment : Fragment(), View.OnClickListener {

private fun setPersonDetailsVisibility(certStatus: CertificateStatus) {
binding.containerPersonDetails.visibility = when (certStatus) {
CertificateStatus.VALID, CertificateStatus.NOT_VALID, CertificateStatus.NOT_VALID_YET, CertificateStatus.PARTIALLY_VALID -> View.VISIBLE
CertificateStatus.VALID, CertificateStatus.NOT_VALID, CertificateStatus.NOT_VALID_YET -> View.VISIBLE
else -> View.GONE
}
}
Expand All @@ -216,7 +215,6 @@ class VerificationFragment : Fragment(), View.OnClickListener {
requireContext(),
when (certStatus) {
CertificateStatus.VALID -> R.color.green
CertificateStatus.PARTIALLY_VALID -> R.color.green
else -> R.color.red_bg
}
)
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<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">Certificazione valida in Italia e in Europa</string>
<string name="certificateValid">Certificazione valida</string>
<string name="certificateNonValid">Certificazione non valida</string>
<string name="certificateRevoked">Certificazione revocata</string>
<string name="certificateNonValidYet">Certificazione non ancora valida</string>
Expand Down Expand Up @@ -74,7 +74,6 @@
<string name="label_name">Nome/Name</string>
<string name="label_close">Chiudi</string>
<string name="label_return_home">Torna all\'inizio</string>
<string name="certificatePartiallyValid">Certificazione valida solo in Italia</string>
<string name="label_what_can_be_done">Cosa si può fare con la certificazione verde COVID-19</string>
<string name="label_why_qr_not_valid">Quali sono i motivi di non validità?</string>
<string name="label_when_qr_valid">Quali sono i tempi di inizio validità?</string>
Expand Down

0 comments on commit 5441838

Please sign in to comment.