From 7819df564d32171a1859e05868c88c4ce33143da Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Mon, 13 Apr 2020 17:36:39 -0300 Subject: [PATCH] ScreenLockedView --- app/index.js | 3 +++ app/sagas/init.js | 5 ++-- app/views/ScreenLockedView.js | 43 +++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 app/views/ScreenLockedView.js diff --git a/app/index.js b/app/index.js index cbc099457..c9ff78dcc 100644 --- a/app/index.js +++ b/app/index.js @@ -569,6 +569,9 @@ export const App = createAppContainer(createSwitchNavigator( AuthLoading: { getScreen: () => require('./views/AuthLoadingView').default }, + ScreenLocked: { + getScreen: () => require('./views/ScreenLockedView').default + }, SetUsernameStack }, { diff --git a/app/sagas/init.js b/app/sagas/init.js index 3e89dff08..e5f8aa624 100644 --- a/app/sagas/init.js +++ b/app/sagas/init.js @@ -106,8 +106,7 @@ const restore = function* restore() { const serverObj = yield serverCollections.find(server); yield put(selectServerRequest(server, serverObj && serverObj.version)); } else { - alert('Cancelled by the user') - // TODO: close the app + yield put(actions.appStart('locked')); } } @@ -127,6 +126,8 @@ const start = function* start({ root, text }) { yield Navigation.navigate('OutsideStack'); } else if (root === 'loading') { yield Navigation.navigate('AuthLoading', { text }); + } else if (root === 'locked') { + yield Navigation.navigate('ScreenLocked'); } RNBootSplash.hide(); }; diff --git a/app/views/ScreenLockedView.js b/app/views/ScreenLockedView.js new file mode 100644 index 000000000..5ab311a77 --- /dev/null +++ b/app/views/ScreenLockedView.js @@ -0,0 +1,43 @@ +import React from 'react'; +import { + View, Text, StyleSheet, ActivityIndicator +} from 'react-native'; +import { connect } from 'react-redux'; + +import { appInit as appInitAction } from '../actions'; +import I18n from '../i18n'; +import StatusBar from '../containers/StatusBar'; +import { withTheme } from '../theme'; +import { themes } from '../constants/colors'; + +import sharedStyles from './Styles'; + +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'center', + alignItems: 'center' + }, + text: { + fontSize: 16, + paddingTop: 10, + ...sharedStyles.textRegular, + ...sharedStyles.textAlignCenter + } +}); + +const ScreenLockedView = React.memo(withTheme(({ theme, appInit }) => { + return ( + + + App locked + Unlock with touchid + + ); +})); + +const mapDispatchToProps = dispatch => ({ + appInit: () => dispatch(appInitAction()) +}); + +export default connect(null, mapDispatchToProps)(withTheme(ScreenLockedView));