aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-02-20 10:16:18 +0800
committerDan <danjm.com@gmail.com>2018-02-20 10:16:18 +0800
commitc26e0d555b7cb89e88713041714206abd8f4275e (patch)
tree28ec5f73a635eea6dd8a1e9c491dd65c921716be
parent13b12efa033a7961d59372bd53473f6251458d98 (diff)
downloadtangerine-wallet-browser-c26e0d555b7cb89e88713041714206abd8f4275e.tar
tangerine-wallet-browser-c26e0d555b7cb89e88713041714206abd8f4275e.tar.gz
tangerine-wallet-browser-c26e0d555b7cb89e88713041714206abd8f4275e.tar.bz2
tangerine-wallet-browser-c26e0d555b7cb89e88713041714206abd8f4275e.tar.lz
tangerine-wallet-browser-c26e0d555b7cb89e88713041714206abd8f4275e.tar.xz
tangerine-wallet-browser-c26e0d555b7cb89e88713041714206abd8f4275e.tar.zst
tangerine-wallet-browser-c26e0d555b7cb89e88713041714206abd8f4275e.zip
Fix Import Existing DEN in popup New UI first time flow.
-rw-r--r--mascara/src/app/first-time/import-seed-phrase-screen.js14
-rw-r--r--mascara/src/app/first-time/index.js49
-rw-r--r--ui/app/app.js2
-rw-r--r--ui/app/first-time/init-menu.js24
4 files changed, 80 insertions, 9 deletions
diff --git a/mascara/src/app/first-time/import-seed-phrase-screen.js b/mascara/src/app/first-time/import-seed-phrase-screen.js
index 181151ca9..a03a16329 100644
--- a/mascara/src/app/first-time/import-seed-phrase-screen.js
+++ b/mascara/src/app/first-time/import-seed-phrase-screen.js
@@ -2,7 +2,13 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import LoadingScreen from './loading-screen'
-import {createNewVaultAndRestore, hideWarning, displayWarning} from '../../../../ui/app/actions'
+import {
+ createNewVaultAndRestore,
+ hideWarning,
+ displayWarning,
+ unMarkPasswordForgotten,
+ clearNotices,
+} from '../../../../ui/app/actions'
class ImportSeedPhraseScreen extends Component {
static propTypes = {
@@ -23,7 +29,7 @@ class ImportSeedPhraseScreen extends Component {
onClick = () => {
const { password, seedPhrase, confirmPassword } = this.state
- const { createNewVaultAndRestore, next, displayWarning } = this.props
+ const { createNewVaultAndRestore, next, displayWarning, leaveImportSeedSreenState } = this.props
if (seedPhrase.split(' ').length !== 12) {
this.warning = 'Seed Phrases are 12 words long'
@@ -43,6 +49,7 @@ class ImportSeedPhraseScreen extends Component {
return
}
this.warning = null
+ leaveImportSeedSreenState()
createNewVaultAndRestore(password, seedPhrase)
.then(next)
}
@@ -113,6 +120,9 @@ class ImportSeedPhraseScreen extends Component {
export default connect(
({ appState: { isLoading, warning } }) => ({ isLoading, warning }),
dispatch => ({
+ leaveImportSeedSreenState: () => {
+ dispatch(unMarkPasswordForgotten())
+ },
createNewVaultAndRestore: (pw, seed) => dispatch(createNewVaultAndRestore(pw, seed)),
displayWarning: (warning) => dispatch(displayWarning(warning)),
hideWarning: () => dispatch(hideWarning()),
diff --git a/mascara/src/app/first-time/index.js b/mascara/src/app/first-time/index.js
index b06f2ba9d..883342d16 100644
--- a/mascara/src/app/first-time/index.js
+++ b/mascara/src/app/first-time/index.js
@@ -7,7 +7,11 @@ import NoticeScreen from './notice-screen'
import BackupPhraseScreen from './backup-phrase-screen'
import ImportAccountScreen from './import-account-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 {
@@ -33,6 +37,7 @@ class FirstTimeFlow extends Component {
NOTICE: 'notice',
BACK_UP_PHRASE: 'back_up_phrase',
CONFIRM_BACK_UP_PHRASE: 'confirm_back_up_phrase',
+ LOADING: 'loading',
};
constructor (props) {
@@ -51,11 +56,15 @@ class FirstTimeFlow extends Component {
isInitialized,
seedWords,
noActiveNotices,
+ forgottenPassword,
} = this.props
const {SCREEN_TYPE} = FirstTimeFlow
// return SCREEN_TYPE.NOTICE
+ if (forgottenPassword) {
+ return SCREEN_TYPE.IMPORT_SEED_PHRASE
+ }
if (!isInitialized) {
return SCREEN_TYPE.CREATE_PASSWORD
}
@@ -71,7 +80,17 @@ class FirstTimeFlow extends Component {
renderScreen () {
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) {
case SCREEN_TYPE.CREATE_PASSWORD:
@@ -92,8 +111,14 @@ class FirstTimeFlow extends Component {
case SCREEN_TYPE.IMPORT_SEED_PHRASE:
return (
<ImportSeedPhraseScreen
- back={() => this.setScreenType(SCREEN_TYPE.CREATE_PASSWORD)}
- next={() => this.setScreenType(SCREEN_TYPE.NOTICE)}
+ back={() => {
+ leaveImportSeedSreenState()
+ this.setScreenType(SCREEN_TYPE.CREATE_PASSWORD)
+ }}
+ next={() => {
+ const newScreenType = forgottenPassword ? null : SCREEN_TYPE.NOTICE
+ this.setScreenType(newScreenType)
+ }}
/>
)
case SCREEN_TYPE.UNIQUE_IMAGE:
@@ -130,13 +155,27 @@ class FirstTimeFlow extends Component {
}
export default connect(
- ({ metamask: { isInitialized, seedWords, noActiveNotices, selectedAddress } }) => ({
+ ({
+ metamask: {
+ isInitialized,
+ seedWords,
+ noActiveNotices,
+ selectedAddress,
+ forgottenPassword,
+ },
+ appState: {
+ isLoading,
+ }
+ }) => ({
isInitialized,
seedWords,
noActiveNotices,
address: selectedAddress,
+ forgottenPassword,
+ isLoading,
}),
dispatch => ({
+ leaveImportSeedSreenState: () => dispatch(unMarkPasswordForgotten()),
goToBuyEtherView: address => dispatch(onboardingBuyEthView(address)),
})
)(FirstTimeFlow)
diff --git a/ui/app/app.js b/ui/app/app.js
index 1a64bb1a4..58e38a077 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -380,7 +380,7 @@ App.prototype.renderPrimary = function () {
if (props.isInitialized && props.forgottenPassword) {
log.debug('rendering restore vault screen')
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
- } else if (!props.isInitialized) {
+ } else if (!props.isInitialized && !props.isUnlocked) {
log.debug('rendering menu screen')
return props.isPopup
? h(OldUIInitializeMenuScreen, {key: 'menuScreenInit'})
diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js
index b4587f1ee..0e08da8db 100644
--- a/ui/app/first-time/init-menu.js
+++ b/ui/app/first-time/init-menu.js
@@ -7,6 +7,8 @@ const Mascot = require('../components/mascot')
const actions = require('../actions')
const Tooltip = require('../components/tooltip')
const getCaretCoordinates = require('textarea-caret')
+const environmentType = require('../../../app/scripts/lib/environment-type')
+const { OLD_UI_NETWORK_TYPE } = require('../../../app/scripts/config').enums
let isSubmitting = false
@@ -130,6 +132,18 @@ InitializeMenuScreen.prototype.renderMenu = function (state) {
}, 'Import Existing DEN'),
]),
+ h('.flex-row.flex-center.flex-grow', [
+ h('p.pointer', {
+ onClick: this.showOldUI.bind(this),
+ style: {
+ fontSize: '0.8em',
+ color: '#aeaeae',
+ textDecoration: 'underline',
+ marginTop: '32px',
+ },
+ }, 'Use classic interface'),
+ ]),
+
])
)
}
@@ -146,7 +160,15 @@ InitializeMenuScreen.prototype.componentDidMount = function () {
}
InitializeMenuScreen.prototype.showRestoreVault = function () {
- this.props.dispatch(actions.showRestoreVault())
+ this.props.dispatch(actions.markPasswordForgotten())
+ if (environmentType() === 'popup') {
+ global.platform.openExtensionInBrowser()
+ }
+}
+
+InitializeMenuScreen.prototype.showOldUI = function () {
+ this.props.dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
+ .then(() => this.props.dispatch(actions.setNetworkEndpoints(OLD_UI_NETWORK_TYPE)))
}
InitializeMenuScreen.prototype.createNewVaultAndKeychain = function () {