Merge pull request #576 from lbryio/first-run-restart

do not proceed past Setup account without an email address
This commit is contained in:
Akinwale Ariwodola 2019-06-08 22:18:12 +01:00 committed by GitHub
commit 6a1287d1b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 17 deletions

View file

@ -38,11 +38,11 @@ class EmailCollectPage extends React.PureComponent {
// save the value to the state email
const { onEmailChanged } = this.props;
this.setState({ email: text });
AsyncStorage.setItem(Constants.KEY_FIRST_RUN_EMAIL, text);
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'true');
if (onEmailChanged) {
onEmailChanged(text);
}
AsyncStorage.setItem(Constants.KEY_FIRST_RUN_EMAIL, text);
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'true');
}
render() {

View file

@ -178,18 +178,16 @@ class FirstRunScreen extends React.PureComponent {
handleEmailCollectPageContinue() {
const { notify, addUserEmail } = this.props;
const { email } = this.state;
// validate the email
if (!email || email.indexOf('@') === -1) {
return notify({
message: 'Please provide a valid email address to continue.',
});
}
AsyncStorage.getItem(Constants.KEY_FIRST_RUN_EMAIL).then(email => {
// validate the email
if (!email || email.indexOf('@') === -1) {
return notify({
message: 'Please provide a valid email address to continue.',
});
}
addUserEmail(email);
this.setState({ emailSubmitted: true });
});
addUserEmail(email);
this.setState({ emailSubmitted: true });
}
checkBottomContainer = (pageName) => {
@ -234,10 +232,9 @@ class FirstRunScreen extends React.PureComponent {
}
onEmailViewLayout = () => {
this.setState({ showBottomContainer: true });
AsyncStorage.getItem('firstRunEmail').then(email => {
this.setState({ showSkip: !email || email.trim().length === 0 });
});
this.setState({ showBottomContainer: true, showSkip: true });
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
}
onWalletPasswordChanged = (password) => {