Starting passcode

This commit is contained in:
Diego Mello 2020-04-16 17:13:20 -03:00
parent 36b39ffaf5
commit 6abb844452
6 changed files with 34 additions and 67 deletions

View File

@ -560,5 +560,6 @@ export default {
Clear: 'Clear',
This_will_clear_all_your_offline_data: 'This will clear all your offline data.',
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'
};

View File

@ -33,14 +33,16 @@ export const localAuthenticate = async(server) => {
return Promise.reject();
}
const isEnrolled = await LocalAuthentication.isEnrolledAsync();
console.log('localAuthenticate -> isEnrolled', isEnrolled);
console.log('localAuthenticate -> serverRecord', serverRecord);
if (serverRecord?.autoLock) {
if (serverRecord?.autoLock && isEnrolled) {
const diffToLastSession = moment().diff(serverRecord?.lastLocalAuthenticatedSession, 'seconds');
console.log('localAuthenticate -> diffToLastSession', diffToLastSession);
if (diffToLastSession >= serverRecord?.autoLockTime) {
const supported = await LocalAuthentication.supportedAuthenticationTypesAsync();
console.log('localAuthenticate -> supported', supported);
const authResult = await LocalAuthentication.authenticateAsync();
const authResult = await LocalAuthentication.authenticateAsync({ disableDeviceFallback: true });
if (authResult?.success) {
await saveLastLocalAuthenticationSession(server);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet, View, Switch, ScrollView
StyleSheet, View, Switch, ScrollView, Text
} from 'react-native';
import { SafeAreaView } from 'react-navigation';
import { connect } from 'react-redux';
@ -48,9 +48,26 @@ const styles = StyleSheet.create({
sectionSeparatorBorder: {
...sharedStyles.separatorVertical,
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 }) => (
<View
style={[
@ -195,11 +212,20 @@ class ScreenLockConfigView extends React.Component {
>
<Separator theme={theme} />
<ListItem
title={`Unlock with ${ autoLockLabel }`}
title='Unlock with Passcode'
right={() => this.renderSwitch()}
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()}
</ScrollView>
</SafeAreaView>

View File

@ -278,7 +278,6 @@ class SettingsView extends React.Component {
title={I18n.t('Screen_lock')}
showActionIndicator
onPress={() => this.navigateToScreen('ScreenLockConfigView')}
// testID='settings-view-theme'
right={this.renderDisclosure}
theme={theme}
/>

View File

@ -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
}

View File

@ -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"
}