ministero-salute / it-dgc-verificaC19-android

VerificaC19 is the official Italian customization of the EU Digital COVID Certificate Verifier App for the Android Operating System
https://www.dgc.gov.it
Apache License 2.0
101 stars 54 forks source link

Resolve: https://github.com/ministero-salute/it-dgc-verificaC19-android/issues/68 #147

Closed shadowsheep1 closed 3 years ago

shadowsheep1 commented 3 years ago

Resolve https://github.com/ministero-salute/it-dgc-verificaC19-android/issues/68 by adding an intent filter that 3rd parties app could use to ask verificaC19 to scan a green pass and obtain the essential scan results (validity — valid, invalid —, date of birth, family and given name).

Example usage:

private fun startC19() {
    startActivityForResult(Intent(
        "it.ministerodellasalute.verificaC19.checkqr"),
        8888
    )
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if (requestCode == 8888) {
        Log.d("TAG","QR code is valid: ${resultCode == Activity.RESULT_OK}")
        if (data?.hasExtra("familyName") == true) {
            Log.d("TAG", "QR code family name: ${data.extras?.get("familyName") ?: ""}")
        }
        if (data?.hasExtra("givenName") == true) {
            Log.d("TAG","QR code given name: ${data.extras?.get("givenName") ?: ""}")
        }
        if (data?.hasExtra("dateOfBirth") == true) {
            Log.d("TAG","QR code dob: ${data.extras?.get("dateOfBirth") ?: ""}")
        }
    }
}
shadowsheep1 commented 3 years ago

@it-eucert-team could you please take a look at this PR?