diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4bfc4ac6..93943fa0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,6 +7,7 @@
+
-
-
-
-
-
-
diff --git a/app/src/main/java/dgca/verifier/app/android/reader/CodeReaderFragment.kt b/app/src/main/java/dgca/verifier/app/android/reader/CodeReaderFragment.kt
index 061878f6..03b3e45e 100644
--- a/app/src/main/java/dgca/verifier/app/android/reader/CodeReaderFragment.kt
+++ b/app/src/main/java/dgca/verifier/app/android/reader/CodeReaderFragment.kt
@@ -160,18 +160,33 @@ class CodeReaderFragment : BindingFragment(), NavCont
binding.countrySelector.setSelection(position)
}
}
+
+ binding.nfcSwitch.setOnCheckedChangeListener { _, isChecked ->
+ if (isChecked) {
+ enableNFC()
+ } else {
+ enableCamera()
+ }
+ }
}
override fun onResume() {
super.onResume()
findNavController().addOnDestinationChangedListener(this)
lastText = ""
+
+ if (binding.nfcSwitch.isChecked) {
+ enableNFC()
+ } else {
+ enableCamera()
+ }
}
override fun onPause() {
super.onPause()
findNavController().removeOnDestinationChangedListener(this)
binding.barcodeScanner.pause()
+ (requireActivity() as MainActivity).disableNfcForegroundDispatch()
}
override fun onDestinationChanged(
@@ -180,11 +195,28 @@ class CodeReaderFragment : BindingFragment(), NavCont
arguments: Bundle?
) {
if (destination.id == R.id.codeReaderFragment) {
- binding.barcodeScanner.resume()
+ if (binding.nfcSwitch.isChecked) {
+ enableNFC()
+ } else {
+ enableCamera()
+ }
+
lastText = ""
}
}
+ private fun enableNFC() {
+ binding.barcodeScanner.pause()
+ binding.nfcOverlay.isVisible = true
+ (requireActivity() as MainActivity).enableNfcForegroundDispatch()
+ }
+
+ private fun enableCamera() {
+ binding.barcodeScanner.resume()
+ binding.nfcOverlay.isVisible = false
+ (requireActivity() as MainActivity).disableNfcForegroundDispatch()
+ }
+
private fun showVerificationResult(
standardizedVerificationResult: StandardizedVerificationResult,
certificateModel: CertificateModel?,
diff --git a/app/src/main/res/layout/fragment_code_reader.xml b/app/src/main/res/layout/fragment_code_reader.xml
index a685a874..2d3927ca 100644
--- a/app/src/main/res/layout/fragment_code_reader.xml
+++ b/app/src/main/res/layout/fragment_code_reader.xml
@@ -22,6 +22,7 @@
@@ -47,6 +48,17 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.85" />
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0f6ab954..0b49c906 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -119,4 +119,6 @@
Certificate valid from
Certificate valid until
Personal data:
+ NFC enabled
+ NFC scan