ScreenLockedView

This commit is contained in:
Diego Mello 2020-04-13 17:36:39 -03:00
parent 616f62d8d0
commit 7819df564d
3 changed files with 49 additions and 2 deletions

View File

@ -569,6 +569,9 @@ export const App = createAppContainer(createSwitchNavigator(
AuthLoading: {
getScreen: () => require('./views/AuthLoadingView').default
},
ScreenLocked: {
getScreen: () => require('./views/ScreenLockedView').default
},
SetUsernameStack
},
{

View File

@ -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();
};

View File

@ -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 (
<View style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]}>
<StatusBar theme={theme} />
<Text style={[styles.text, { color: themes[theme].bodyText }]}>App locked</Text>
<Text style={[styles.text, { color: themes[theme].tintColor }]} onPress={appInit}>Unlock with touchid</Text>
</View>
);
}));
const mapDispatchToProps = dispatch => ({
appInit: () => dispatch(appInitAction())
});
export default connect(null, mapDispatchToProps)(withTheme(ScreenLockedView));