|
|
@ -7,7 +7,11 @@ import NoticeScreen from './notice-screen' |
|
|
|
import BackupPhraseScreen from './backup-phrase-screen' |
|
|
|
import BackupPhraseScreen from './backup-phrase-screen' |
|
|
|
import ImportAccountScreen from './import-account-screen' |
|
|
|
import ImportAccountScreen from './import-account-screen' |
|
|
|
import ImportSeedPhraseScreen from './import-seed-phrase-screen' |
|
|
|
import ImportSeedPhraseScreen from './import-seed-phrase-screen' |
|
|
|
import {onboardingBuyEthView} from '../../../../ui/app/actions' |
|
|
|
const Loading = require('../../../../ui/app//components/loading') |
|
|
|
|
|
|
|
import { |
|
|
|
|
|
|
|
onboardingBuyEthView, |
|
|
|
|
|
|
|
unMarkPasswordForgotten, |
|
|
|
|
|
|
|
} from '../../../../ui/app/actions' |
|
|
|
|
|
|
|
|
|
|
|
class FirstTimeFlow extends Component { |
|
|
|
class FirstTimeFlow extends Component { |
|
|
|
|
|
|
|
|
|
|
@ -33,6 +37,7 @@ class FirstTimeFlow extends Component { |
|
|
|
NOTICE: 'notice', |
|
|
|
NOTICE: 'notice', |
|
|
|
BACK_UP_PHRASE: 'back_up_phrase', |
|
|
|
BACK_UP_PHRASE: 'back_up_phrase', |
|
|
|
CONFIRM_BACK_UP_PHRASE: 'confirm_back_up_phrase', |
|
|
|
CONFIRM_BACK_UP_PHRASE: 'confirm_back_up_phrase', |
|
|
|
|
|
|
|
LOADING: 'loading', |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
constructor (props) { |
|
|
|
constructor (props) { |
|
|
@ -51,11 +56,15 @@ class FirstTimeFlow extends Component { |
|
|
|
isInitialized, |
|
|
|
isInitialized, |
|
|
|
seedWords, |
|
|
|
seedWords, |
|
|
|
noActiveNotices, |
|
|
|
noActiveNotices, |
|
|
|
|
|
|
|
forgottenPassword, |
|
|
|
} = this.props |
|
|
|
} = this.props |
|
|
|
const {SCREEN_TYPE} = FirstTimeFlow |
|
|
|
const {SCREEN_TYPE} = FirstTimeFlow |
|
|
|
|
|
|
|
|
|
|
|
// return SCREEN_TYPE.NOTICE
|
|
|
|
// return SCREEN_TYPE.NOTICE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (forgottenPassword) { |
|
|
|
|
|
|
|
return SCREEN_TYPE.IMPORT_SEED_PHRASE |
|
|
|
|
|
|
|
} |
|
|
|
if (!isInitialized) { |
|
|
|
if (!isInitialized) { |
|
|
|
return SCREEN_TYPE.CREATE_PASSWORD |
|
|
|
return SCREEN_TYPE.CREATE_PASSWORD |
|
|
|
} |
|
|
|
} |
|
|
@ -71,7 +80,17 @@ class FirstTimeFlow extends Component { |
|
|
|
|
|
|
|
|
|
|
|
renderScreen () { |
|
|
|
renderScreen () { |
|
|
|
const {SCREEN_TYPE} = FirstTimeFlow |
|
|
|
const {SCREEN_TYPE} = FirstTimeFlow |
|
|
|
const {goToBuyEtherView, address} = this.props |
|
|
|
const { |
|
|
|
|
|
|
|
goToBuyEtherView, |
|
|
|
|
|
|
|
address, |
|
|
|
|
|
|
|
restoreCreatePasswordScreen, |
|
|
|
|
|
|
|
forgottenPassword, |
|
|
|
|
|
|
|
isLoading, |
|
|
|
|
|
|
|
} = this.props |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isLoading) { |
|
|
|
|
|
|
|
return h(Loading) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch (this.state.screenType) { |
|
|
|
switch (this.state.screenType) { |
|
|
|
case SCREEN_TYPE.CREATE_PASSWORD: |
|
|
|
case SCREEN_TYPE.CREATE_PASSWORD: |
|
|
@ -92,8 +111,14 @@ class FirstTimeFlow extends Component { |
|
|
|
case SCREEN_TYPE.IMPORT_SEED_PHRASE: |
|
|
|
case SCREEN_TYPE.IMPORT_SEED_PHRASE: |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<ImportSeedPhraseScreen |
|
|
|
<ImportSeedPhraseScreen |
|
|
|
back={() => this.setScreenType(SCREEN_TYPE.CREATE_PASSWORD)} |
|
|
|
back={() => { |
|
|
|
next={() => this.setScreenType(SCREEN_TYPE.NOTICE)} |
|
|
|
leaveImportSeedSreenState() |
|
|
|
|
|
|
|
this.setScreenType(SCREEN_TYPE.CREATE_PASSWORD) |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
next={() => { |
|
|
|
|
|
|
|
const newScreenType = forgottenPassword ? null : SCREEN_TYPE.NOTICE |
|
|
|
|
|
|
|
this.setScreenType(newScreenType) |
|
|
|
|
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
) |
|
|
|
) |
|
|
|
case SCREEN_TYPE.UNIQUE_IMAGE: |
|
|
|
case SCREEN_TYPE.UNIQUE_IMAGE: |
|
|
@ -130,13 +155,27 @@ class FirstTimeFlow extends Component { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default connect( |
|
|
|
export default connect( |
|
|
|
({ metamask: { isInitialized, seedWords, noActiveNotices, selectedAddress } }) => ({ |
|
|
|
({ |
|
|
|
|
|
|
|
metamask: { |
|
|
|
|
|
|
|
isInitialized, |
|
|
|
|
|
|
|
seedWords, |
|
|
|
|
|
|
|
noActiveNotices, |
|
|
|
|
|
|
|
selectedAddress, |
|
|
|
|
|
|
|
forgottenPassword, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
appState: { |
|
|
|
|
|
|
|
isLoading, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) => ({ |
|
|
|
isInitialized, |
|
|
|
isInitialized, |
|
|
|
seedWords, |
|
|
|
seedWords, |
|
|
|
noActiveNotices, |
|
|
|
noActiveNotices, |
|
|
|
address: selectedAddress, |
|
|
|
address: selectedAddress, |
|
|
|
|
|
|
|
forgottenPassword, |
|
|
|
|
|
|
|
isLoading, |
|
|
|
}), |
|
|
|
}), |
|
|
|
dispatch => ({ |
|
|
|
dispatch => ({ |
|
|
|
|
|
|
|
leaveImportSeedSreenState: () => dispatch(unMarkPasswordForgotten()), |
|
|
|
goToBuyEtherView: address => dispatch(onboardingBuyEthView(address)), |
|
|
|
goToBuyEtherView: address => dispatch(onboardingBuyEthView(address)), |
|
|
|
}) |
|
|
|
}) |
|
|
|
)(FirstTimeFlow) |
|
|
|
)(FirstTimeFlow) |
|
|
|