mirror of
https://github.com/bitwarden/android.git
synced 2025-02-16 11:59:57 +03:00
Clean up QrCodeScanScreen to avoid test error action (#1327)
This commit is contained in:
parent
880d26e259
commit
862c7f110c
1 changed files with 12 additions and 7 deletions
|
@ -54,6 +54,7 @@ import androidx.compose.ui.text.withStyle
|
|||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect
|
||||
|
@ -283,18 +284,22 @@ private fun CameraPreview(
|
|||
ProcessCameraProvider.getInstance(context).also { future ->
|
||||
future.addListener(
|
||||
{ continuation.resume(future.get()) },
|
||||
Executors.newSingleThreadExecutor(),
|
||||
ContextCompat.getMainExecutor(context),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
cameraProvider?.unbindAll()
|
||||
cameraProvider?.bindToLifecycle(
|
||||
lifecycleOwner,
|
||||
CameraSelector.DEFAULT_BACK_CAMERA,
|
||||
preview,
|
||||
imageAnalyzer,
|
||||
)
|
||||
if (cameraProvider?.hasCamera(CameraSelector.DEFAULT_BACK_CAMERA) == true) {
|
||||
cameraProvider?.bindToLifecycle(
|
||||
lifecycleOwner,
|
||||
CameraSelector.DEFAULT_BACK_CAMERA,
|
||||
preview,
|
||||
imageAnalyzer,
|
||||
)
|
||||
} else {
|
||||
cameraErrorReceive()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
cameraErrorReceive()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue