From 6abb8444523116b0aec7ec1ba54fa1caef360da9 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Thu, 16 Apr 2020 17:13:20 -0300 Subject: [PATCH] Starting passcode --- app/i18n/locales/en.js | 3 +- app/utils/localAuthentication.js | 6 ++- app/views/ScreenLockConfigView.js | 30 ++++++++++++- app/views/SettingsView/index.js | 1 - .../EXAppLoaderProvider.podspec.json | 18 -------- .../Local Podspecs/SocketRocket.podspec.json | 43 ------------------- 6 files changed, 34 insertions(+), 67 deletions(-) delete mode 100644 ios/Pods/Local Podspecs/EXAppLoaderProvider.podspec.json delete mode 100644 ios/Pods/Local Podspecs/SocketRocket.podspec.json diff --git a/app/i18n/locales/en.js b/app/i18n/locales/en.js index 6b485ea72..35b5aef94 100644 --- a/app/i18n/locales/en.js +++ b/app/i18n/locales/en.js @@ -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' }; diff --git a/app/utils/localAuthentication.js b/app/utils/localAuthentication.js index c571ff2a1..3d2367623 100644 --- a/app/utils/localAuthentication.js +++ b/app/utils/localAuthentication.js @@ -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); } diff --git a/app/views/ScreenLockConfigView.js b/app/views/ScreenLockConfigView.js index d88b7b269..ccbbed745 100644 --- a/app/views/ScreenLockConfigView.js +++ b/app/views/ScreenLockConfigView.js @@ -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 }) => ( + + {info} + +)); +ItemInfo.propTypes = { + info: PropTypes.string, + theme: PropTypes.string +}; + const SectionSeparator = React.memo(({ theme }) => ( this.renderSwitch()} theme={theme} /> + + + {this.renderAutoLockItems()} diff --git a/app/views/SettingsView/index.js b/app/views/SettingsView/index.js index b1bdf8659..b57b064f7 100644 --- a/app/views/SettingsView/index.js +++ b/app/views/SettingsView/index.js @@ -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} /> diff --git a/ios/Pods/Local Podspecs/EXAppLoaderProvider.podspec.json b/ios/Pods/Local Podspecs/EXAppLoaderProvider.podspec.json deleted file mode 100644 index a1a8517cd..000000000 --- a/ios/Pods/Local Podspecs/EXAppLoaderProvider.podspec.json +++ /dev/null @@ -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 -} diff --git a/ios/Pods/Local Podspecs/SocketRocket.podspec.json b/ios/Pods/Local Podspecs/SocketRocket.podspec.json deleted file mode 100644 index 0497ad5f8..000000000 --- a/ios/Pods/Local Podspecs/SocketRocket.podspec.json +++ /dev/null @@ -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" -}