Skip to content

Commit

Permalink
Change variables scope
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolmello committed May 15, 2020
1 parent a35311b commit ef6e686
Showing 1 changed file with 11 additions and 11 deletions.
Expand Up @@ -33,10 +33,6 @@ public class LocalAuthenticationModule extends ExportedModule {
private boolean mIsAuthenticating = false;
private ModuleRegistry mModuleRegistry;
private UIManager mUIManager;
private String mPromptMessage = "";
private String mCancelLabel = "";
private boolean mDisableDeviceFallback = false;

private static final int AUTHENTICATION_TYPE_FINGERPRINT = 1;

private final BiometricPrompt.AuthenticationCallback mAuthenticationCallback =
Expand Down Expand Up @@ -134,16 +130,20 @@ public void run() {
return;
}

String promptMessage = "";
String cancelLabel = "";
boolean disableDeviceFallback = false;

if (options.containsKey("promptMessage")) {
mPromptMessage = (String) options.get("promptMessage");
promptMessage = (String) options.get("promptMessage");
}

if (options.containsKey("cancelLabel")) {
mCancelLabel = (String) options.get("cancelLabel");
cancelLabel = (String) options.get("cancelLabel");
}

if (options.containsKey("disableDeviceFallback")) {
mDisableDeviceFallback = (Boolean) options.get("disableDeviceFallback");
disableDeviceFallback = (Boolean) options.get("disableDeviceFallback");
}

mIsAuthenticating = true;
Expand All @@ -155,10 +155,10 @@ public void run() {
BiometricPrompt biometricPrompt = new BiometricPrompt(fragmentActivity, executor, mAuthenticationCallback);

BiometricPrompt.PromptInfo.Builder promptInfoBuilder = new BiometricPrompt.PromptInfo.Builder()
.setDeviceCredentialAllowed(!mDisableDeviceFallback)
.setTitle(mPromptMessage);
if (mCancelLabel != null && mDisableDeviceFallback) {
promptInfoBuilder.setNegativeButtonText(mCancelLabel);
.setDeviceCredentialAllowed(!disableDeviceFallback)
.setTitle(promptMessage);
if (cancelLabel != null && disableDeviceFallback) {
promptInfoBuilder.setNegativeButtonText(cancelLabel);
}
BiometricPrompt.PromptInfo promptInfo = promptInfoBuilder.build();
biometricPrompt.authenticate(promptInfo);
Expand Down

0 comments on commit ef6e686

Please sign in to comment.