Starting passcode
This commit is contained in:
parent
36b39ffaf5
commit
6abb844452
|
@ -560,5 +560,6 @@ export default {
|
||||||
Clear: 'Clear',
|
Clear: 'Clear',
|
||||||
This_will_clear_all_your_offline_data: 'This will clear all your offline data.',
|
This_will_clear_all_your_offline_data: 'This will clear all your offline data.',
|
||||||
Mark_unread: 'Mark Unread',
|
Mark_unread: 'Mark Unread',
|
||||||
Wait_activation_warning: 'Before you can login, your account must be manually activated by an administrator.'
|
Wait_activation_warning: 'Before you can login, your account must be manually activated by an administrator.',
|
||||||
|
Screen_lock: 'Screen lock'
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,14 +33,16 @@ export const localAuthenticate = async(server) => {
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isEnrolled = await LocalAuthentication.isEnrolledAsync();
|
||||||
|
console.log('localAuthenticate -> isEnrolled', isEnrolled);
|
||||||
console.log('localAuthenticate -> serverRecord', serverRecord);
|
console.log('localAuthenticate -> serverRecord', serverRecord);
|
||||||
if (serverRecord?.autoLock) {
|
if (serverRecord?.autoLock && isEnrolled) {
|
||||||
const diffToLastSession = moment().diff(serverRecord?.lastLocalAuthenticatedSession, 'seconds');
|
const diffToLastSession = moment().diff(serverRecord?.lastLocalAuthenticatedSession, 'seconds');
|
||||||
console.log('localAuthenticate -> diffToLastSession', diffToLastSession);
|
console.log('localAuthenticate -> diffToLastSession', diffToLastSession);
|
||||||
if (diffToLastSession >= serverRecord?.autoLockTime) {
|
if (diffToLastSession >= serverRecord?.autoLockTime) {
|
||||||
const supported = await LocalAuthentication.supportedAuthenticationTypesAsync();
|
const supported = await LocalAuthentication.supportedAuthenticationTypesAsync();
|
||||||
console.log('localAuthenticate -> supported', supported);
|
console.log('localAuthenticate -> supported', supported);
|
||||||
const authResult = await LocalAuthentication.authenticateAsync();
|
const authResult = await LocalAuthentication.authenticateAsync({ disableDeviceFallback: true });
|
||||||
if (authResult?.success) {
|
if (authResult?.success) {
|
||||||
await saveLastLocalAuthenticationSession(server);
|
await saveLastLocalAuthenticationSession(server);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
StyleSheet, View, Switch, ScrollView
|
StyleSheet, View, Switch, ScrollView, Text
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { SafeAreaView } from 'react-navigation';
|
import { SafeAreaView } from 'react-navigation';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
@ -48,9 +48,26 @@ const styles = StyleSheet.create({
|
||||||
sectionSeparatorBorder: {
|
sectionSeparatorBorder: {
|
||||||
...sharedStyles.separatorVertical,
|
...sharedStyles.separatorVertical,
|
||||||
height: 36
|
height: 36
|
||||||
|
},
|
||||||
|
infoContainer: {
|
||||||
|
padding: 15
|
||||||
|
},
|
||||||
|
infoText: {
|
||||||
|
fontSize: 14,
|
||||||
|
...sharedStyles.textRegular
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const ItemInfo = React.memo(({ info, theme }) => (
|
||||||
|
<View style={[styles.infoContainer, { backgroundColor: themes[theme].auxiliaryBackground }]}>
|
||||||
|
<Text style={[styles.infoText, { color: themes[theme].infoText }]}>{info}</Text>
|
||||||
|
</View>
|
||||||
|
));
|
||||||
|
ItemInfo.propTypes = {
|
||||||
|
info: PropTypes.string,
|
||||||
|
theme: PropTypes.string
|
||||||
|
};
|
||||||
|
|
||||||
const SectionSeparator = React.memo(({ theme }) => (
|
const SectionSeparator = React.memo(({ theme }) => (
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
|
@ -195,11 +212,20 @@ class ScreenLockConfigView extends React.Component {
|
||||||
>
|
>
|
||||||
<Separator theme={theme} />
|
<Separator theme={theme} />
|
||||||
<ListItem
|
<ListItem
|
||||||
title={`Unlock with ${ autoLockLabel }`}
|
title='Unlock with Passcode'
|
||||||
right={() => this.renderSwitch()}
|
right={() => this.renderSwitch()}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
/>
|
/>
|
||||||
<Separator theme={theme} />
|
<Separator theme={theme} />
|
||||||
|
<ListItem
|
||||||
|
title='Change Passcode'
|
||||||
|
theme={theme}
|
||||||
|
/>
|
||||||
|
<Separator theme={theme} />
|
||||||
|
<ItemInfo
|
||||||
|
info={'Note: if you forget the passcode, you\'ll need to delete and reinstall the app.'}
|
||||||
|
theme={theme}
|
||||||
|
/>
|
||||||
{this.renderAutoLockItems()}
|
{this.renderAutoLockItems()}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
|
|
@ -278,7 +278,6 @@ class SettingsView extends React.Component {
|
||||||
title={I18n.t('Screen_lock')}
|
title={I18n.t('Screen_lock')}
|
||||||
showActionIndicator
|
showActionIndicator
|
||||||
onPress={() => this.navigateToScreen('ScreenLockConfigView')}
|
onPress={() => this.navigateToScreen('ScreenLockConfigView')}
|
||||||
// testID='settings-view-theme'
|
|
||||||
right={this.renderDisclosure}
|
right={this.renderDisclosure}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "EXAppLoaderProvider",
|
|
||||||
"version": "6.0.0",
|
|
||||||
"summary": "Provides application loaders",
|
|
||||||
"description": "Provides application loaders",
|
|
||||||
"license": "MIT",
|
|
||||||
"authors": "650 Industries, Inc.",
|
|
||||||
"homepage": "https://github.com/expo/expo/tree/master/packages/expo-app-loader-provider",
|
|
||||||
"platforms": {
|
|
||||||
"ios": "10.0"
|
|
||||||
},
|
|
||||||
"source": {
|
|
||||||
"git": "https://github.com/expo/expo.git"
|
|
||||||
},
|
|
||||||
"source_files": "EXAppLoaderProvider/**/*.{h,m}",
|
|
||||||
"preserve_paths": "EXAppLoaderProvider/**/*.{h,m}",
|
|
||||||
"requires_arc": true
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
{
|
|
||||||
"name": "SocketRocket",
|
|
||||||
"version": "0.5.1",
|
|
||||||
"summary": "A conforming WebSocket (RFC 6455) client library for iOS, macOS and tvOS.",
|
|
||||||
"homepage": "https://github.com/facebook/SocketRocket",
|
|
||||||
"authors": {
|
|
||||||
"Nikita Lutsenko": "nlutsenko@me.com",
|
|
||||||
"Dan Federman": "federman@squareup.com",
|
|
||||||
"Mike Lewis": "mikelikespie@gmail.com"
|
|
||||||
},
|
|
||||||
"license": "BSD",
|
|
||||||
"source": {
|
|
||||||
"git": "https://github.com/facebook/SocketRocket.git",
|
|
||||||
"tag": "0.5.1"
|
|
||||||
},
|
|
||||||
"requires_arc": true,
|
|
||||||
"source_files": "SocketRocket/**/*.{h,m}",
|
|
||||||
"public_header_files": "SocketRocket/*.h",
|
|
||||||
"platforms": {
|
|
||||||
"ios": "6.0",
|
|
||||||
"osx": "10.8",
|
|
||||||
"tvos": "9.0"
|
|
||||||
},
|
|
||||||
"ios": {
|
|
||||||
"frameworks": [
|
|
||||||
"CFNetwork",
|
|
||||||
"Security"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"osx": {
|
|
||||||
"frameworks": [
|
|
||||||
"CoreServices",
|
|
||||||
"Security"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"tvos": {
|
|
||||||
"frameworks": [
|
|
||||||
"CFNetwork",
|
|
||||||
"Security"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"libraries": "icucore"
|
|
||||||
}
|
|
Loading…
Reference in New Issue