Skip to content

Commit

Permalink
Using yellow color to show a valid QR signed by a test key.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Jul 23, 2022
1 parent b22346d commit 67a0ccf
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions app/src/main/java/org/who/ddccverifier/views/ResultFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.who.ddccverifier.services.*
import org.who.ddccverifier.services.cql.CQLEvaluator
import org.who.ddccverifier.services.cql.FHIRLibraryLoader
import org.who.ddccverifier.services.trust.TrustRegistrySingleton
import org.who.ddccverifier.trust.TrustRegistry
import org.who.ddccverifier.verify.QRDecoder
import java.io.InputStream

Expand Down Expand Up @@ -109,9 +110,14 @@ class ResultFragment : Fragment() {
QRDecoder.Status.VERIFIED -> binding.tvResultTitle.text = resources.getString(R.string.verification_status_verified)
}

if (binding.tvResultTitle.text == resources.getString(R.string.verification_status_verified)) {
binding.tvResultHeader.background = resources.getDrawable(R.drawable.rounded_pill, null)
binding.tvResultSignedByIcon.setTextColor(resources.getColor(R.color.success100, null))
if (DDCC.status == QRDecoder.Status.VERIFIED) {
if (DDCC.issuer!!.scope == TrustRegistry.Scope.PRODUCTION) {
binding.tvResultHeader.background = resources.getDrawable(R.drawable.rounded_pill, null)
binding.tvResultTitle.text = resources.getString(R.string.verification_status_verified)
} else {
binding.tvResultHeader.background = resources.getDrawable(R.drawable.rounded_pill_test, null)
binding.tvResultTitle.text = resources.getString(R.string.verification_status_verified_test_scope)
}
binding.tvResultTitleIcon.text = resources.getString(R.string.fa_check_circle_solid)
} else {
binding.tvResultHeader.background = resources.getDrawable(R.drawable.rounded_pill_invalid, null)
Expand All @@ -121,7 +127,10 @@ class ResultFragment : Fragment() {

if (DDCC.issuer != null) {
binding.tvResultSignedBy.text = "Signed by " + DDCC.issuer!!.displayName["en"]
binding.tvResultSignedByIcon.setTextColor(resources.getColor(R.color.success100, null))
if (DDCC.issuer!!.scope == TrustRegistry.Scope.PRODUCTION)
binding.tvResultSignedByIcon.setTextColor(resources.getColor(R.color.success100, null))
else
binding.tvResultSignedByIcon.setTextColor(resources.getColor(R.color.warning50, null))
binding.tvResultSignedByIcon.text = resources.getString(R.string.fa_check_circle_solid)
} else {
binding.tvResultSignedBy.text = resources.getString(R.string.verification_status_invalid_signature)
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/res/drawable/rounded_pill_test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@color/warning50">
</solid>
<stroke
android:width="0dp"
android:color="#424242">
</stroke>
<corners
android:topLeftRadius="100dip"
android:topRightRadius="100dip"
android:bottomLeftRadius="100dip"
android:bottomRightRadius="100dip">
</corners>
</shape>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@
<string name="verification_status_revoked_keys">Issuer Revoked</string>
<string name="verification_status_invalid_signature">Invalid Signature</string>
<string name="verification_status_verified">Signature Verified</string>
<string name="verification_status_verified_test_scope">Signature Verified (Dev)</string>
</resources>

0 comments on commit 67a0ccf

Please sign in to comment.