From bf84396a86f5dc724301056c98f6bf67ecd07ef6 Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Thu, 21 Dec 2023 18:12:46 +0100 Subject: [PATCH] current stand --- app/build.gradle | 2 + app/src/main/AndroidManifest.xml | 2 + .../java/app/myzel394/alibi/db/AppSettings.kt | 21 ++++++++- .../java/app/myzel394/alibi/ui/Navigation.kt | 43 +++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 03d67f5..20252d1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -146,4 +146,6 @@ dependencies { implementation "com.valentinilk.shimmer:compose-shimmer:1.2.0" + + implementation "androidx.biometric:biometric-ktx:1.2.0-alpha05" } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3d59dbe..fdab32f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -24,6 +24,8 @@ + + = Build.VERSION_CODES.R) { + val executor = ContextCompat.getMainExecutor(context) + val promptInfo = BiometricPrompt.Builder(context) + .setTitle("Biometric login for my app") + .setSubtitle("Log in using your biometric credential") + .setAllowedAuthenticators( + BIOMETRIC_STRONG or DEVICE_CREDENTIAL + ) + .build() + + // Prompt appears when user clicks "Log in". + // Consider integrating with the keystore to unlock cryptographic operations, + // if needed by your app. + promptInfo.authenticate( + CancellationSignal(), + executor, + object : BiometricPrompt.AuthenticationCallback() { + override fun onAuthenticationError(errorCode: Int, errString: CharSequence) { + super.onAuthenticationError(errorCode, errString) + } + + override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) { + super.onAuthenticationSucceeded(result) + } + + override fun onAuthenticationFailed() { + super.onAuthenticationFailed() + } + }) + } + } + LaunchedEffect(settings.theme) { if (!SUPPORTS_DARK_MODE_NATIVELY) { val currentValue = AppCompatDelegate.getDefaultNightMode()