feat: add postinstall script for patch-package fix: update react-native-biometrics to support device credentials refactor: remove FaceAuth, Home, LockScreen, Managelock, and related auth files chore: update TypeScript configuration for React Native
57 lines
2.4 KiB
Diff
57 lines
2.4 KiB
Diff
diff --git a/node_modules/react-native-biometrics/android/src/main/java/com/rnbiometrics/ReactNativeBiometrics.java b/node_modules/react-native-biometrics/android/src/main/java/com/rnbiometrics/ReactNativeBiometrics.java
|
|
index 624ecd9..d135072 100644
|
|
--- a/node_modules/react-native-biometrics/android/src/main/java/com/rnbiometrics/ReactNativeBiometrics.java
|
|
+++ b/node_modules/react-native-biometrics/android/src/main/java/com/rnbiometrics/ReactNativeBiometrics.java
|
|
@@ -182,24 +182,38 @@ public class ReactNativeBiometrics extends ReactContextBaseJavaModule {
|
|
}
|
|
}
|
|
|
|
- private PromptInfo getPromptInfo(String promptMessage, String cancelButtonText, boolean allowDeviceCredentials) {
|
|
- PromptInfo.Builder builder = new PromptInfo.Builder().setTitle(promptMessage);
|
|
+ private BiometricPrompt.PromptInfo getPromptInfo(
|
|
+ String promptMessage,
|
|
+ String cancelButtonText,
|
|
+ boolean allowDeviceCredentials
|
|
+) {
|
|
+ BiometricPrompt.PromptInfo.Builder builder =
|
|
+ new BiometricPrompt.PromptInfo.Builder()
|
|
+ .setTitle(promptMessage);
|
|
+
|
|
+ builder.setAllowedAuthenticators(
|
|
+ getAllowedAuthenticators(allowDeviceCredentials)
|
|
+ );
|
|
+
|
|
+ if (!allowDeviceCredentials || isCurrentSDK29OrEarlier()) {
|
|
+ builder.setNegativeButtonText(cancelButtonText);
|
|
+ }
|
|
|
|
- builder.setAllowedAuthenticators(getAllowedAuthenticators(allowDeviceCredentials));
|
|
+ return builder.build();
|
|
+}
|
|
|
|
- if (allowDeviceCredentials == false || isCurrentSDK29OrEarlier()) {
|
|
- builder.setNegativeButtonText(cancelButtonText);
|
|
- }
|
|
+private int getAllowedAuthenticators(boolean allowDeviceCredentials) {
|
|
+ int authenticators = BiometricManager.Authenticators.BIOMETRIC_WEAK;
|
|
|
|
- return builder.build();
|
|
+ if (allowDeviceCredentials) {
|
|
+ authenticators |= BiometricManager.Authenticators.DEVICE_CREDENTIAL;
|
|
}
|
|
|
|
- private int getAllowedAuthenticators(boolean allowDeviceCredentials) {
|
|
- if (allowDeviceCredentials && !isCurrentSDK29OrEarlier()) {
|
|
- return BiometricManager.Authenticators.BIOMETRIC_STRONG | BiometricManager.Authenticators.DEVICE_CREDENTIAL;
|
|
- }
|
|
- return BiometricManager.Authenticators.BIOMETRIC_STRONG;
|
|
- }
|
|
+ return authenticators;
|
|
+}
|
|
+
|
|
+
|
|
+
|
|
|
|
private boolean isCurrentSDK29OrEarlier() {
|
|
return Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q;
|