Commit 4efbff3e by Nguyễn Thị Thúy

fix bug fingerprint

parent 534162d9
......@@ -35,6 +35,7 @@ import KeychainService from '../../services/keychainService';
import * as Keychain from 'react-native-keychain';
import EntypoIcon from 'react-native-vector-icons/Entypo';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import DeviceInfo from 'react-native-device-info';
const Login = (props) => {
const {navigation} = props;
......@@ -86,8 +87,12 @@ const Login = (props) => {
};
const getCredentialInfo = async () => {
try {
const appBundleId = await DeviceInfo.getBundleId(); // only used for android as default for service on iOS is bundleId
// Retrieve the credentials
const options = {
service: Platform.OS === 'ios' ? undefined : appBundleId,
forceAuth: true,
authenticationPrompt: {
title: 'Authentication needed',
cancel: 'Cancel',
......
......@@ -15,6 +15,8 @@ import {showLoading, hideLoading} from '../../actions/loadingAction';
import {verifyPassword} from '../../apis/Functions/users';
import {showAlert, TYPE} from '../../components/DropdownAlert';
import TouchID from 'react-native-touch-id'
import DeviceInfo from 'react-native-device-info';
const dataLanguage = [
......@@ -81,8 +83,11 @@ const SettingView = (props) => {
});
if (res.status == 200 && res.data) {
if (res.data.code == 200) {
const appBundleId = await DeviceInfo.getBundleId(); // only used for android as default for service on iOS is bundleId
await Keychain.setGenericPassword(props.user.email, pass, {
service: Platform.OS === 'ios' ? undefined : appBundleId,
accessControl: Keychain.ACCESS_CONTROL.BIOMETRY_CURRENT_SET,
accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
});
AsyncStorage.setItem(KEY.IS_LOGIN_BY_BIOMETRY, JSON.stringify({isLoginByBiometry : true}));
setIsEnabled(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment