From 7598f88837841b26d170fde14eaeb8b1806f8b5f Mon Sep 17 00:00:00 2001 From: Arthur Martello Date: Tue, 7 Jan 2020 14:56:45 +0100 Subject: [PATCH] App was wiped after every login without Biometric hardware --- src/screens/AppLoader.js | 12 +++++------- src/services/BiometricAuth.js | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/screens/AppLoader.js b/src/screens/AppLoader.js index a9e8048c..3b8ddab9 100644 --- a/src/screens/AppLoader.js +++ b/src/screens/AppLoader.js @@ -185,13 +185,11 @@ class AppLoaderScreen extends React.Component { const { restrictions } = this.props; - BiometricAuth.hasHardware() - .then(hasHardware => { - if (!hasHardware && restrictions !== []) { - return this.reinitData(); - } - }) - .catch(() => {}); + BiometricAuth.hasHardware().catch(() => { + if (restrictions.length > 0) { + return this.reinitData(); + } + }); if (data.type === PayUTC.CAS_AUTH_TYPE) { return this.checkCasConnection(data.ticket, data.login, data.password); diff --git a/src/services/BiometricAuth.js b/src/services/BiometricAuth.js index f8faf2ce..7e85dfda 100644 --- a/src/services/BiometricAuth.js +++ b/src/services/BiometricAuth.js @@ -25,7 +25,7 @@ export const defaultSecurity = [TRANSFER, REFILL, BADGE_LOCKING]; export const advancedSecurity = [TRANSFER, REFILL, BADGE_LOCKING, APP_OPENING]; export default class BiometricAuth extends React.PureComponent { - static async hasHardware() { + static hasHardware() { return LocalAuthentication.hasHardwareAsync(); } @@ -47,7 +47,7 @@ export default class BiometricAuth extends React.PureComponent { const hasHardware = await BiometricAuth.hasHardware(); // If the Security Mode has not been properly disabled - if (!hasHardware && restrictions !== []) { + if (!hasHardware && restrictions.length > 0) { PayUTC.forget().payload.then(() => { navigation.navigate('Auth');