From 20da1b6461b837267a13b329ed368408d91e109d Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 7 Jun 2019 06:21:09 +0100 Subject: [PATCH] do not proceed past Setup account without an email address --- .../firstRun/internal/email-collect-page.js | 4 +-- app/src/page/firstRun/view.js | 27 +++++++++---------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/app/src/page/firstRun/internal/email-collect-page.js b/app/src/page/firstRun/internal/email-collect-page.js index 0d370451..8efb95c4 100644 --- a/app/src/page/firstRun/internal/email-collect-page.js +++ b/app/src/page/firstRun/internal/email-collect-page.js @@ -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() { diff --git a/app/src/page/firstRun/view.js b/app/src/page/firstRun/view.js index be70f04a..ee630cc9 100644 --- a/app/src/page/firstRun/view.js +++ b/app/src/page/firstRun/view.js @@ -182,18 +182,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) => { @@ -238,10 +236,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) => {