Unverified Commit 30a29951 authored by Fedor Sakharov's avatar Fedor Sakharov
Browse files

fix: android: filter out non qr barcodes

parent 0cac7bde
......@@ -21,7 +21,9 @@ import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.content.ContextCompat
import com.google.mlkit.vision.barcode.BarcodeScannerOptions
import com.google.mlkit.vision.barcode.BarcodeScanning
import com.google.mlkit.vision.barcode.common.Barcode
import io.parity.signer.components.ScanProgressBar
import io.parity.signer.models.SignerDataModel
import io.parity.signer.models.processFrame
......@@ -46,7 +48,12 @@ fun ScanScreen(signerDataModel: SignerDataModel) {
factory = { context ->
val executor = ContextCompat.getMainExecutor(context)
val previewView = PreviewView(context)
val barcodeScanner = BarcodeScanning.getClient()
// mlkit docs: The default option is not recommended because it tries
// to scan all barcode formats, which is slow.
val options = BarcodeScannerOptions.Builder()
.setBarcodeFormats(Barcode.FORMAT_QR_CODE).build()
val barcodeScanner = BarcodeScanning.getClient(options)
//This might be done more elegantly, if needed.
//But it's pretty obvious that the app needs camera
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment