diff --git a/node_modules/expo-local-authentication/android/android-expo-local-authentication.iml b/node_modules/expo-local-authentication/android/android-expo-local-authentication.iml new file mode 100644 index 0000000..8401261 --- /dev/null +++ b/node_modules/expo-local-authentication/android/android-expo-local-authentication.iml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/expo-local-authentication/android/src/main/java/expo/modules/localauthentication/LocalAuthenticationModule.java b/node_modules/expo-local-authentication/android/src/main/java/expo/modules/localauthentication/LocalAuthenticationModule.java index babaf55..d665886 100644 --- a/node_modules/expo-local-authentication/android/src/main/java/expo/modules/localauthentication/LocalAuthenticationModule.java +++ b/node_modules/expo-local-authentication/android/src/main/java/expo/modules/localauthentication/LocalAuthenticationModule.java @@ -24,6 +24,7 @@ import org.unimodules.core.Promise; import org.unimodules.core.interfaces.ActivityProvider; import org.unimodules.core.interfaces.ExpoMethod; import org.unimodules.core.interfaces.services.UIManager; +import org.unimodules.core.arguments.ReadableArguments; public class LocalAuthenticationModule extends ExportedModule { private final BiometricManager mBiometricManager; @@ -32,6 +33,9 @@ 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; @@ -96,7 +100,7 @@ public class LocalAuthenticationModule extends ExportedModule { } @ExpoMethod - public void authenticateAsync(final Promise promise) { + public void authenticateAsync(final ReadableArguments options, final Promise promise) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { promise.reject("E_NOT_SUPPORTED", "Cannot display biometric prompt on android versions below 6.0"); return; @@ -130,6 +134,18 @@ public class LocalAuthenticationModule extends ExportedModule { return; } + if (options.containsKey("promptMessage")) { + mPromptMessage = options.getString("promptMessage"); + } + + if (options.containsKey("cancelLabel")) { + mCancelLabel = options.getString("cancelLabel"); + } + + if (options.containsKey("disableDeviceFallback")) { + mDisableDeviceFallback = options.getBoolean("disableDeviceFallback"); + } + mIsAuthenticating = true; mPromise = promise; mCancellationSignal = new CancellationSignal(); @@ -138,10 +154,13 @@ public class LocalAuthenticationModule extends ExportedModule { Executor executor = Executors.newSingleThreadExecutor(); BiometricPrompt biometricPrompt = new BiometricPrompt(fragmentActivity, executor, mAuthenticationCallback); - BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder() - .setDeviceCredentialAllowed(true) - .setTitle("Authenticate") - .build(); + BiometricPrompt.PromptInfo.Builder promptInfoBuilder = new BiometricPrompt.PromptInfo.Builder() + .setDeviceCredentialAllowed(!mDisableDeviceFallback) + .setTitle(mPromptMessage); + if (mCancelLabel != null && mDisableDeviceFallback) { + promptInfoBuilder.setNegativeButtonText(mCancelLabel); + } + BiometricPrompt.PromptInfo promptInfo = promptInfoBuilder.build(); biometricPrompt.authenticate(promptInfo); } }); diff --git a/node_modules/expo-local-authentication/build/LocalAuthentication.js b/node_modules/expo-local-authentication/build/LocalAuthentication.js index f4d4420..53c794a 100644 --- a/node_modules/expo-local-authentication/build/LocalAuthentication.js +++ b/node_modules/expo-local-authentication/build/LocalAuthentication.js @@ -1,6 +1,5 @@ import { UnavailabilityError } from '@unimodules/core'; import invariant from 'invariant'; -import { Platform } from 'react-native'; import ExpoLocalAuthentication from './ExpoLocalAuthentication'; import { AuthenticationType, } from './LocalAuthentication.types'; export { AuthenticationType }; @@ -31,20 +30,15 @@ export async function authenticateAsync(options = {}) { console.warn('String argument in LocalAuthentication.authenticateAsync has been deprecated. Please use options object with `promptMessage` key instead.'); options = { promptMessage: options }; } - if (Platform.OS === 'ios') { - if (options.hasOwnProperty('promptMessage')) { - invariant(typeof options.promptMessage === 'string' && options.promptMessage.length, 'LocalAuthentication.authenticateAsync : `options.promptMessage` must be a non-empty string.'); - } - const promptMessage = options.promptMessage || 'Authenticate'; - const result = await ExpoLocalAuthentication.authenticateAsync({ ...options, promptMessage }); - if (result.warning) { - console.warn(result.warning); - } - return result; + if (options.hasOwnProperty('promptMessage')) { + invariant(typeof options.promptMessage === 'string' && options.promptMessage.length, 'LocalAuthentication.authenticateAsync : `options.promptMessage` must be a non-empty string.'); } - else { - return await ExpoLocalAuthentication.authenticateAsync(); + const promptMessage = options.promptMessage || 'Authenticate'; + const result = await ExpoLocalAuthentication.authenticateAsync({ ...options, promptMessage }); + if (result.warning) { + console.warn(result.warning); } + return result; } export async function cancelAuthenticate() { if (!ExpoLocalAuthentication.cancelAuthenticate) { diff --git a/node_modules/expo-local-authentication/build/LocalAuthentication.js.map b/node_modules/expo-local-authentication/build/LocalAuthentication.js.map index ca5c5a3..42df04f 100644 --- a/node_modules/expo-local-authentication/build/LocalAuthentication.js.map +++ b/node_modules/expo-local-authentication/build/LocalAuthentication.js.map @@ -1 +1 @@ -{"version":3,"file":"LocalAuthentication.js","sourceRoot":"","sources":["../src/LocalAuthentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAEL,kBAAkB,GAEnB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAA8B,kBAAkB,EAA6B,CAAC;AAErF,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,EAAE;QAC7C,MAAM,IAAI,mBAAmB,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAAC;KAChF;IACD,OAAO,MAAM,uBAAuB,CAAC,gBAAgB,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iCAAiC;IACrD,IA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AC9B;QACD,OAAO,MAAM,CAAC;KACf;SAAM;QACL,OAAO,MAAM,uBAAuB,CAAC,iBAAiB,EAAE,CAAC;KAC1D;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,IAAI,CAAC,uBAAuB,CAAC,kBAAkB,EAAE;QAC/C,MAAM,IAAI,mBAAmB,CAAC,2BAA2B,EAAE,oBAAoB,CAAC,CAAC;KAClF;IACD,MAAM,uBAAuB,CAAC,kBAAkB,EAAE,CAAC;AACrD,CAAC","sourcesContent":["import { UnavailabilityError } from '@unimodules/core';\nimport invariant from 'invariant';\nimport { Platform } from 'react-native';\n\nimport ExpoLocalAuthentication from './ExpoLocalAuthentication';\nimport {\n LocalAuthenticationOptions,\n AuthenticationType,\n LocalAuthenticationResult,\n} from './LocalAuthentication.types';\n\nexport { LocalAuthenticationOptions, AuthenticationType, LocalAuthenticationResult };\n\nexport async function hasHardwareAsync(): Promise {\n if (!ExpoLocalAuthentication.hasHardwareAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'hasHardwareAsync');\n }\n return await ExpoLocalAuthentication.hasHardwareAsync();\n}\n\nexport async function supportedAuthenticationTypesAsync(): Promise {\n if (!ExpoLocalAuthentication.supportedAuthenticationTypesAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'supportedAuthenticationTypesAsync');\n }\n return await ExpoLocalAuthentication.supportedAuthenticationTypesAsync();\n}\n\nexport async function isEnrolledAsync(): Promise {\n if (!ExpoLocalAuthentication.isEnrolledAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'isEnrolledAsync');\n }\n return await ExpoLocalAuthentication.isEnrolledAsync();\n}\n\nexport async function authenticateAsync(\n options: LocalAuthenticationOptions = {}\n): Promise {\n if (!ExpoLocalAuthentication.authenticateAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'authenticateAsync');\n }\n\n // Warn if using an old API - to be removed in SDK35.\n if (typeof options === 'string') {\n console.warn(\n 'String argument in LocalAuthentication.authenticateAsync has been deprecated. Please use options object with `promptMessage` key instead.'\n );\n options = { promptMessage: options };\n }\n\n if (Platform.OS === 'ios') {\n if (options.hasOwnProperty('promptMessage')) {\n invariant(\n typeof options.promptMessage === 'string' && options.promptMessage.length,\n 'LocalAuthentication.authenticateAsync : `options.promptMessage` must be a non-empty string.'\n );\n }\n\n const promptMessage = options.promptMessage || 'Authenticate';\n const result = await ExpoLocalAuthentication.authenticateAsync({ ...options, promptMessage });\n\n if (result.warning) {\n console.warn(result.warning);\n }\n return result;\n } else {\n return await ExpoLocalAuthentication.authenticateAsync();\n }\n}\n\nexport async function cancelAuthenticate(): Promise {\n if (!ExpoLocalAuthentication.cancelAuthenticate) {\n throw new UnavailabilityError('expo-local-authentication', 'cancelAuthenticate');\n }\n await ExpoLocalAuthentication.cancelAuthenticate();\n}\n"]} \ No newline at end of file +{"version":3,"file":"LocalAuthentication.js","sourceRoot":"","sources":["../src/LocalAuthentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,SAAS,MAAM,WAAW,CAAC;AAGlC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAEL,kBAAkB,GAEnB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAA8B,kBAAkB,EAA6B,CAAC;AAErF,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,EAAE;QAC7C,MAAM,IAAI,mBAAmB,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAAC;KAChF;IACD,OAAO,MAAM,uBAAuB,CAAC,gBAAgB,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iCAAiC;IACrD,IAAI,CAAC,uBAAuB,CAAC,iCAAiC,EAAE;QAC9D,MAAM,IAAI,mBAAmB,CAAC,2BAA2B,EAAE,mCAAmC,CAAC,CAAC;KACjG;IACD,OAAO,MAAM,uBAAuB,CAAC,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;KAClF;IACD,MAAM,uBAAuB,CAAC,kBAAkB,EAAE,CAAC;AACrD,CAAC","sourcesContent":["import { UnavailabilityError } from '@unimodules/core';\nimport invariant from 'invariant';\nimport { Platform } from 'react-native';\n\nimport ExpoLocalAuthentication from './ExpoLocalAuthentication';\nimport {\n LocalAuthenticationOptions,\n AuthenticationType,\n LocalAuthenticationResult,\n} from './LocalAuthentication.types';\n\nexport { LocalAuthenticationOptions, AuthenticationType, LocalAuthenticationResult };\n\nexport async function hasHardwareAsync(): Promise {\n if (!ExpoLocalAuthentication.hasHardwareAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'hasHardwareAsync');\n }\n return await ExpoLocalAuthentication.hasHardwareAsync();\n}\n\nexport async function supportedAuthenticationTypesAsync(): Promise {\n if (!ExpoLocalAuthentication.supportedAuthenticationTypesAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'supportedAuthenticationTypesAsync');\n }\n return await ExpoLocalAuthentication.supportedAuthenticationTypesAsync();\n}\n\nexport async function isEnrolledAsync(): Promise {\n if (!ExpoLocalAuthentication.isEnrolledAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'isEnrolledAsync');\n }\n return await ExpoLocalAuthentication.isEnrolledAsync();\n}\n\nexport async function authenticateAsync(\n options: LocalAuthenticationOptions = {}\n): Promise {\n if (!ExpoLocalAuthentication.authenticateAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'authenticateAsync');\n }\n\n // Warn if using an old API - to be removed in SDK35.\n if (typeof options === 'string') {\n console.warn(\n 'String argument in LocalAuthentication.authenticateAsync has been deprecated. Please use options object with `promptMessage` key instead.'\n );\n options = { promptMessage: options };\n }\n\n if (options.hasOwnProperty('promptMessage')) {\n invariant(\n typeof options.promptMessage === 'string' && options.promptMessage.length,\n 'LocalAuthentication.authenticateAsync : `options.promptMessage` must be a non-empty string.'\n );\n }\n\n\n const promptMessage = options.promptMessage || 'Authenticate';\n const result = await ExpoLocalAuthentication.authenticateAsync({ ...options, promptMessage });\n\n if (result.warning) {\n console.warn(result.warning);\n }\n return result;\n}\n\nexport async function cancelAuthenticate(): Promise {\n if (!ExpoLocalAuthentication.cancelAuthenticate) {\n throw new UnavailabilityError('expo-local-authentication', 'cancelAuthenticate');\n }\n await ExpoLocalAuthentication.cancelAuthenticate();\n}\n"]} \ No newline at end of file diff --git a/node_modules/expo-local-authentication/build/LocalAuthentication.types.d.ts b/node_modules/expo-local-authentication/build/LocalAuthentication.types.d.ts index 4732e60..17fa82d 100644 --- a/node_modules/expo-local-authentication/build/LocalAuthentication.types.d.ts +++ b/node_modules/expo-local-authentication/build/LocalAuthentication.types.d.ts @@ -11,6 +11,6 @@ export declare enum AuthenticationType { export declare type LocalAuthenticationOptions = { promptMessage?: string; cancelLabel?: string; - fallbackLabel?: string; disableDeviceFallback?: boolean; + fallbackLabel?: string; }; diff --git a/node_modules/expo-local-authentication/build/LocalAuthentication.types.js.map b/node_modules/expo-local-authentication/build/LocalAuthentication.types.js.map index c31dd6d..e413ea0 100644 --- a/node_modules/expo-local-authentication/build/LocalAuthentication.types.js.map +++ b/node_modules/expo-local-authentication/build/LocalAuthentication.types.js.map @@ -1 +1 @@ -{"version":3,"file":"LocalAuthentication.types.js","sourceRoot":"","sources":["../src/LocalAuthentication.types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,yEAAe,CAAA;IACf,uFAAsB,CAAA;AACxB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B","sourcesContent":["export type LocalAuthenticationResult = { success: true } | { success: false; error: string };\n\nexport enum AuthenticationType {\n FINGERPRINT = 1,\n FACIAL_RECOGNITION = 2,\n}\n\nexport type LocalAuthenticationOptions = {\n // iOS only\n promptMessage?: string;\n cancelLabel?: string;\n fallbackLabel?: string;\n disableDeviceFallback?: boolean;\n};\n"]} \ No newline at end of file +{"version":3,"file":"LocalAuthentication.types.js","sourceRoot":"","sources":["../src/LocalAuthentication.types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,yEAAe,CAAA;IACf,uFAAsB,CAAA;AACxB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B","sourcesContent":["export type LocalAuthenticationResult = { success: true } | { success: false; error: string };\n\nexport enum AuthenticationType {\n FINGERPRINT = 1,\n FACIAL_RECOGNITION = 2,\n}\n\nexport type LocalAuthenticationOptions = {\n promptMessage?: string;\n cancelLabel?: string;\n disableDeviceFallback?: boolean;\n // iOS only\n fallbackLabel?: string;\n};\n"]} \ No newline at end of file