mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-29 00:20:04 +01:00
add basic fingerprint auth on app launch
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React, {useEffect} from 'react';
|
||||
import {BackHandler} from 'react-native';
|
||||
import Orientation from 'react-native-orientation';
|
||||
import {SafeAreaProvider} from 'react-native-safe-area-context';
|
||||
import SplashScreen from 'react-native-splash-screen';
|
||||
@@ -7,7 +8,9 @@ import {RootView} from './initializer.root';
|
||||
import AppLoader from './src/components/AppLoader';
|
||||
import {useTracked} from './src/provider';
|
||||
import {Actions} from './src/provider/Actions';
|
||||
import BiometricService from './src/services/BiometricService';
|
||||
import {DDS} from './src/services/DeviceDetection';
|
||||
import RNExitApp from 'react-native-exit-app';
|
||||
import {
|
||||
eSendEvent,
|
||||
eSubscribeEvent,
|
||||
@@ -36,10 +39,28 @@ const App = () => {
|
||||
: 'mobile',
|
||||
});
|
||||
});
|
||||
|
||||
let func = async () => {
|
||||
eSendEvent(eOpenSideMenu);
|
||||
SplashScreen.hide();
|
||||
await db.init();
|
||||
};
|
||||
|
||||
await SettingsService.init();
|
||||
eSendEvent(eOpenSideMenu);
|
||||
SplashScreen.hide();
|
||||
await db.init();
|
||||
if (SettingsService.get().appLockMode !== 'none') {
|
||||
let result = await BiometricService.validateUser(
|
||||
'Unlock to access your notes',
|
||||
'',
|
||||
);
|
||||
if (result) {
|
||||
await func();
|
||||
} else {
|
||||
RNExitApp.exitApp();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
await func();
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
initStatus = true;
|
||||
|
||||
Reference in New Issue
Block a user