From fe76096c96705f55fda9b4ddbfba8993500fa8cc Mon Sep 17 00:00:00 2001 From: Lamparter Date: Tue, 16 Jul 2024 19:05:56 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Add=20correct=20navigation=20gra?= =?UTF-8?q?ph=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/dev/riverside/credit/Biometrics.kt | 13 ++++++--- .../main/java/dev/riverside/credit/Main.kt | 5 ++++ app/src/main/res/layout/auth_biometric.xml | 26 +++++++++++++----- app/src/main/res/layout/smart_tap.xml | 14 +++------- app/src/main/res/navigation/nav_graph.xml | 27 ++++++++++++------- 5 files changed, 53 insertions(+), 32 deletions(-) diff --git a/app/src/main/java/dev/riverside/credit/Biometrics.kt b/app/src/main/java/dev/riverside/credit/Biometrics.kt index 8f19974..ba78746 100644 --- a/app/src/main/java/dev/riverside/credit/Biometrics.kt +++ b/app/src/main/java/dev/riverside/credit/Biometrics.kt @@ -7,11 +7,14 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Toast +import android.hardware.biometrics.BiometricManager.Authenticators +import androidx.biometric.BiometricManager import androidx.core.content.ContextCompat import androidx.navigation.findNavController import androidx.navigation.fragment.findNavController import dev.riverside.credit.databinding.AuthBiometricBinding import java.util.concurrent.Executor +import kotlin.system.exitProcess class Biometrics : Fragment() { @@ -42,12 +45,13 @@ class Biometrics : Fragment() { override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) { super.onAuthenticationSucceeded(result) val navController = view?.findNavController() - navController?.navigate(R.id.action_FirstFragment_to_SecondFragment) + navController?.navigate(R.id.action_biometrics_to_homepage) } override fun onAuthenticationFailed() { super.onAuthenticationFailed() // TODO: Handle failure + exitProcess(77) } } @@ -55,9 +59,10 @@ class Biometrics : Fragment() { val biometricPrompt = BiometricPrompt(this, executor, callback) val promptInfo = BiometricPrompt.PromptInfo.Builder() - .setTitle("Biometric Authentication") - .setSubtitle("Log in using your biometric credential") - .setNegativeButtonText("Cancel") + .setTitle("Verify that it's you") + .setDescription("For your security, you need to verify that it's you before using Smart Tap") + .setNegativeButtonText(" ") + .setConfirmationRequired(true) .build() // Start authentication diff --git a/app/src/main/java/dev/riverside/credit/Main.kt b/app/src/main/java/dev/riverside/credit/Main.kt index 85850eb..5cf55a9 100644 --- a/app/src/main/java/dev/riverside/credit/Main.kt +++ b/app/src/main/java/dev/riverside/credit/Main.kt @@ -9,8 +9,13 @@ import androidx.navigation.ui.navigateUp import androidx.navigation.ui.setupActionBarWithNavController import android.view.Menu import android.view.MenuItem +import android.view.View +import androidx.biometric.BiometricPrompt import androidx.compose.material3.NavigationBar +import androidx.core.content.ContextCompat import dev.riverside.credit.databinding.ActivityMainBinding +import java.util.concurrent.Executor +import kotlin.system.exitProcess class Main : AppCompatActivity() { diff --git a/app/src/main/res/layout/auth_biometric.xml b/app/src/main/res/layout/auth_biometric.xml index 4af4cad..31c05b0 100644 --- a/app/src/main/res/layout/auth_biometric.xml +++ b/app/src/main/res/layout/auth_biometric.xml @@ -1,9 +1,21 @@ - + - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/layout/smart_tap.xml b/app/src/main/res/layout/smart_tap.xml index a9a060f..95b25e2 100644 --- a/app/src/main/res/layout/smart_tap.xml +++ b/app/src/main/res/layout/smart_tap.xml @@ -9,20 +9,12 @@ - \ No newline at end of file diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index 2133f47..af7b599 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -3,21 +3,28 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/nav_graph" - app:startDestination="@id/FirstFragment"> - + app:startDestination="@id/biometrics"> + - + android:id="@+id/action_biometrics_to_homepage" + app:destination="@id/homepage" /> + + android:label="smart_tap" + tools:layout="@layout/smart_tap" /> \ No newline at end of file