Apply on saved data
This commit is contained in:
parent
67a934313e
commit
fa93c26744
|
@ -32,18 +32,18 @@ export const localAuthenticate = async(server) => {
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
const diffToLastSession = moment().diff(serverRecord?.lastLocalAuthenticatedSession, 'seconds');
|
if (serverRecord?.autoLock) {
|
||||||
console.log('localAuthenticate -> diffToLastSession', diffToLastSession);
|
const diffToLastSession = moment().diff(serverRecord?.lastLocalAuthenticatedSession, 'seconds');
|
||||||
// if (diffToLastSession >= 5) {
|
if (diffToLastSession >= serverRecord?.autoLockTime) {
|
||||||
// const supported = await LocalAuthentication.supportedAuthenticationTypesAsync()
|
const supported = await LocalAuthentication.supportedAuthenticationTypesAsync();
|
||||||
// console.log('localAuthenticate -> supported', supported);
|
const authResult = await LocalAuthentication.authenticateAsync();
|
||||||
// const authResult = await LocalAuthentication.authenticateAsync();
|
if (authResult?.success) {
|
||||||
// if (authResult?.success) {
|
await saveLastLocalAuthenticationSession(server);
|
||||||
// await saveLastLocalAuthenticationSession(server);
|
}
|
||||||
// }
|
return Promise.resolve(authResult?.success);
|
||||||
// return Promise.resolve(authResult?.success);
|
} else {
|
||||||
// } else {
|
await saveLastLocalAuthenticationSession(server);
|
||||||
// await saveLastLocalAuthenticationSession(server);
|
}
|
||||||
// }
|
}
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
StyleSheet, FlatList, View, Text, Linking, Switch, ScrollView
|
StyleSheet, View, Switch, ScrollView
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { SafeAreaView } from 'react-navigation';
|
import { SafeAreaView } from 'react-navigation';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import { themedHeader } from '../utils/navigation';
|
import { themedHeader } from '../utils/navigation';
|
||||||
|
@ -15,7 +16,6 @@ import Separator from '../containers/Separator';
|
||||||
import ListItem from '../containers/ListItem';
|
import ListItem from '../containers/ListItem';
|
||||||
import { CustomIcon } from '../lib/Icons';
|
import { CustomIcon } from '../lib/Icons';
|
||||||
import database from '../lib/database';
|
import database from '../lib/database';
|
||||||
import { connect } from 'react-redux';
|
|
||||||
|
|
||||||
const DEFAULT_AUTO_LOCK = [
|
const DEFAULT_AUTO_LOCK = [
|
||||||
{
|
{
|
||||||
|
@ -44,19 +44,10 @@ const styles = StyleSheet.create({
|
||||||
listPadding: {
|
listPadding: {
|
||||||
paddingVertical: 36
|
paddingVertical: 36
|
||||||
},
|
},
|
||||||
info: {
|
|
||||||
paddingTop: 25,
|
|
||||||
paddingBottom: 18,
|
|
||||||
paddingHorizontal: 16
|
|
||||||
},
|
|
||||||
infoText: {
|
|
||||||
fontSize: 16,
|
|
||||||
...sharedStyles.textRegular
|
|
||||||
},
|
|
||||||
sectionSeparatorBorder: {
|
sectionSeparatorBorder: {
|
||||||
...sharedStyles.separatorVertical,
|
...sharedStyles.separatorVertical,
|
||||||
height: 36
|
height: 36
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const SectionSeparator = React.memo(({ theme }) => (
|
const SectionSeparator = React.memo(({ theme }) => (
|
||||||
|
|
Loading…
Reference in New Issue