diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 11814b5f5..a2c6003c9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,6 +14,13 @@ + + + - if (index == 0) { - otpImportAction.launch( - IntentIntegrator(this@PasswordCreationActivity) - .setOrientationLocked(false) - .setBeepEnabled(false) - .setDesiredBarcodeFormats(QR_CODE) - .createScanIntent() - ) - } else if (index == 1) { - OtpImportDialogFragment().show(supportFragmentManager, "OtpImport") + val hasCamera = packageManager?.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY) == true + if (hasCamera) { + val items = arrayOf(getString(R.string.otp_import_qr_code), getString(R.string.otp_import_manual_entry)) + MaterialAlertDialogBuilder(this@PasswordCreationActivity) + .setItems(items) { _, index -> + when (index) { + 0 -> + otpImportAction.launch( + IntentIntegrator(this@PasswordCreationActivity) + .setOrientationLocked(false) + .setBeepEnabled(false) + .setDesiredBarcodeFormats(QR_CODE) + .createScanIntent() + ) + 1 -> OtpImportDialogFragment().show(supportFragmentManager, "OtpImport") + } } - } - .show() + .show() + } else { + OtpImportDialogFragment().show(supportFragmentManager, "OtpImport") + } } directoryInputLayout.apply {