Skip to content

Commit

Permalink
fix: Issue: zingolabs#618 in Android fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
juanky201271 committed Mar 20, 2024
1 parent d7aeeae commit cf87452
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/simpleBiometrics.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
import RNBiometrics from 'react-native-simple-biometrics';
import { TranslateType } from './AppState';

import ReactNativeBiometrics from 'react-native-biometrics';

type simpleBiometricsProps = {
translate: (key: string) => TranslateType;
};

const simpleBiometrics = async (props: simpleBiometricsProps) => {
const rnBiometrics = new ReactNativeBiometrics({ allowDeviceCredentials: true });

const { available, biometryType, error } = await rnBiometrics.isSensorAvailable();

console.log(available, biometryType, error);

if (!available) {
return true;
}

try {
await RNBiometrics.requestBioAuth(
props.translate('biometrics-title') as string,
props.translate('biometrics-message') as string,
);
// Code to execute when authenticated
return true;
} catch (error) {
} catch (e) {
// Code to handle authentication failure
console.log(e);
return false;
}
};
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native": "0.70.7",
"react-native-biometrics": "^3.0.1",
"react-native-camera": "^4.2.1",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.7.1",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7112,6 +7112,11 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react-native-biometrics@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/react-native-biometrics/-/react-native-biometrics-3.0.1.tgz#23c5a0bdbae1fcb1e08b22936223fe0fc4af846e"
integrity sha512-Ru80gXRa9KG04sl5AB9HyjLjVbduhqZVjA+AiOSGqr+fNqCDmCu9y5WEksnjbnniNLmq1yGcw+qcLXmR1ddLDQ==

react-native-camera@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/react-native-camera/-/react-native-camera-4.2.1.tgz#caf74081f055e89d7e9b0cd5108965d808c60e90"
Expand Down

0 comments on commit cf87452

Please sign in to comment.