migrated to use expo/localauth package instead of fingerprint-scanner

This commit is contained in:
noumantahir 2024-05-16 18:48:23 +05:00
parent 06deb8ed0c
commit 5f9f643a47
4 changed files with 23 additions and 6 deletions

View File

@ -40,6 +40,8 @@ PODS:
- SDWebImageWebPCoder (~> 0.13.0)
- ExpoKeepAwake (12.8.2):
- ExpoModulesCore
- ExpoLocalAuthentication (13.8.0):
- ExpoModulesCore
- ExpoModulesCore (1.11.10):
- glog
- RCT-Folly (= 2022.05.16.00)
@ -1446,6 +1448,7 @@ DEPENDENCIES:
- ExpoFileSystem (from `../node_modules/expo-file-system/ios`)
- ExpoImage (from `../node_modules/expo-image/ios`)
- ExpoKeepAwake (from `../node_modules/expo-keep-awake/ios`)
- ExpoLocalAuthentication (from `../node_modules/expo-local-authentication/ios`)
- ExpoModulesCore (from `../node_modules/expo-modules-core`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
@ -1635,6 +1638,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/expo-image/ios"
ExpoKeepAwake:
:path: "../node_modules/expo-keep-awake/ios"
ExpoLocalAuthentication:
:path: "../node_modules/expo-local-authentication/ios"
ExpoModulesCore:
:path: "../node_modules/expo-modules-core"
FBLazyVector:
@ -1842,6 +1847,7 @@ SPEC CHECKSUMS:
ExpoFileSystem: eecaf6796aed0f4dd20042dc2ca2cac6c4bc1185
ExpoImage: 8cf2d51de3d03b7e984e9b0ba8f19c0c22057001
ExpoKeepAwake: 0f5cad99603a3268e50af9a6eb8b76d0d9ac956c
ExpoLocalAuthentication: c55ffb179683efed04cb144fc80ccf26891f0cb4
ExpoModulesCore: b2ae7a3fc6193556273c5db90065fbe7e11c7a60
FBLazyVector: fbc4957d9aa695250b55d879c1d86f79d7e69ab4
FBReactNativeSpec: 86de768f89901ef6ed3207cd686362189d64ac88

View File

@ -85,6 +85,7 @@
"events": "^1.0.0",
"expo": "^50.0.8",
"expo-image": "~1.10.6",
"expo-local-authentication": "~13.8.0",
"hive-uri": "^0.2.5",
"hivesigner": "^3.3.4",
"https-browserify": "~0.0.0",

View File

@ -4,7 +4,7 @@ import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
import Config from 'react-native-config';
import get from 'lodash/get';
import FingerprintScanner from 'react-native-fingerprint-scanner';
import * as LocalAuthentication from 'expo-local-authentication';
// Actions & Services
import { useNavigation } from '@react-navigation/native';
@ -83,12 +83,15 @@ class PinCodeContainer extends Component {
return;
}
const biometryType = await FingerprintScanner.isSensorAvailable();
const biometryType = await LocalAuthentication.hasHardwareAsync()
console.log('biometryType is => ', biometryType);
await FingerprintScanner.authenticate({
description: intl.formatMessage({ id: 'pincode.biometric_desc' }),
});
await LocalAuthentication.authenticateAsync({
promptMessage:intl.formatMessage({ id: 'pincode.biometric_desc' })
})
console.log('successfully passed biometric auth');
// code gets here means biometeric succeeded
@ -101,7 +104,7 @@ class PinCodeContainer extends Component {
console.warn('Failed to process biometric', err);
}
FingerprintScanner.release();
LocalAuthentication.cancelAuthenticate();
};
// this function updates realm with appropriate master key required for encyrption

View File

@ -6738,6 +6738,13 @@ expo-keep-awake@~12.8.2:
resolved "https://registry.yarnpkg.com/expo-keep-awake/-/expo-keep-awake-12.8.2.tgz#6cfdf8ad02b5fa130f99d4a1eb98e459d5b4332e"
integrity sha512-uiQdGbSX24Pt8nGbnmBtrKq6xL/Tm3+DuDRGBk/3ZE/HlizzNosGRIufIMJ/4B4FRw4dw8KU81h2RLuTjbay6g==
expo-local-authentication@~13.8.0:
version "13.8.0"
resolved "https://registry.yarnpkg.com/expo-local-authentication/-/expo-local-authentication-13.8.0.tgz#21d9870bbaff0804325bd70f171273560a4293bb"
integrity sha512-h0YA7grVdo3834AS70EUCsalaXrrEnoq+yTvIhRTxiPmzWxUv7rNo5ff+XsIEYNElKPmT/wh/xPV1yo3l3fhGg==
dependencies:
invariant "^2.2.4"
expo-modules-autolinking@1.10.3:
version "1.10.3"
resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-1.10.3.tgz#19f349884a90f3f27ec9d64e8f2fa6be609558c5"