react-native-simple-biometrics icon indicating copy to clipboard operation
react-native-simple-biometrics copied to clipboard

Option to disable Pin/Pattern

Open LonelyCpp opened this issue 3 years ago • 2 comments

is there any possibility to hide the 'UsePin/UsePattern' form the prompt in android

Originally posted by @ndileep-dev in https://github.com/smallcase/react-native-simple-biometrics/issues/3#issuecomment-871886727

LonelyCpp avatar Jul 01 '21 04:07 LonelyCpp

I use the following patch file to disable pin/pattern.

Filename: react-native-simple-biometrics+1.5.0.patch

diff --git a/node_modules/react-native-simple-biometrics/android/src/main/java/com/reactnativesimplebiometrics/SimpleBiometricsModule.java b/node_modules/react-native-simple-biometrics/android/src/main/java/com/reactnativesimplebiometrics/SimpleBiometricsModule.java
index d4c53a4..ab08598 100644
--- a/node_modules/react-native-simple-biometrics/android/src/main/java/com/reactnativesimplebiometrics/SimpleBiometricsModule.java
+++ b/node_modules/react-native-simple-biometrics/android/src/main/java/com/reactnativesimplebiometrics/SimpleBiometricsModule.java
@@ -23,8 +23,7 @@ public class SimpleBiometricsModule extends ReactContextBaseJavaModule {
     public static final String NAME = "SimpleBiometrics";
 
     static final int authenticators =  BiometricManager.Authenticators.BIOMETRIC_STRONG
-        | BiometricManager.Authenticators.BIOMETRIC_WEAK
-        | BiometricManager.Authenticators.DEVICE_CREDENTIAL;
+        | BiometricManager.Authenticators.BIOMETRIC_WEAK;
 
     public SimpleBiometricsModule(ReactApplicationContext reactContext) {
         super(reactContext);
@@ -82,6 +81,7 @@ public class SimpleBiometricsModule extends ReactContextBaseJavaModule {
                                         .setAllowedAuthenticators(authenticators)
                                         .setTitle(title)
                                         .setSubtitle(subtitle)
+                                        .setNegativeButtonText("Cancel")
                                         .build();
 
                                 prompt.authenticate(promptInfo);
diff --git a/node_modules/react-native-simple-biometrics/ios/SimpleBiometrics.mm b/node_modules/react-native-simple-biometrics/ios/SimpleBiometrics.mm
index 620c8ee..e91f895 100644
--- a/node_modules/react-native-simple-biometrics/ios/SimpleBiometrics.mm
+++ b/node_modules/react-native-simple-biometrics/ios/SimpleBiometrics.mm
@@ -33,10 +33,10 @@ @implementation SimpleBiometrics
 {
 
     dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        NSString *promptMessage = subtitle;
+        NSString *promptMessage = title;
 
         LAContext *context = [[LAContext alloc] init];
-        context.localizedFallbackTitle = title;
+        context.localizedFallbackTitle = @"";
 
         LAPolicy localAuthPolicy = LAPolicyDeviceOwnerAuthenticationWithBiometrics;
         if (![[UIDevice currentDevice].systemVersion hasPrefix:@"8."]) {

dcangulo avatar Sep 16 '22 09:09 dcangulo

I agree this feature should be added

VariabileAleatoria avatar Oct 07 '22 18:10 VariabileAleatoria