Added check if Android device has a camera
This commit is contained in:
parent
74d42abce3
commit
54e9a70122
|
@ -1,6 +1,7 @@
|
|||
package net.codinux.banking.ui.service
|
||||
|
||||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import android.view.ScaleGestureDetector
|
||||
import androidx.camera.core.*
|
||||
import androidx.camera.lifecycle.ProcessCameraProvider
|
||||
|
@ -30,7 +31,10 @@ actual object QrCodeService {
|
|||
private val log by logger()
|
||||
|
||||
|
||||
actual val supportsReadingQrCodesFromCamera = true
|
||||
actual val supportsReadingQrCodesFromCamera = hasCamera()
|
||||
|
||||
private fun hasCamera(): Boolean = AndroidContext.applicationContext.packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)
|
||||
|
||||
|
||||
@Composable
|
||||
actual fun readQrCodeFromCamera(resultCallback: (QrCodeReadResult) -> Unit) {
|
||||
|
|
Loading…
Reference in New Issue