mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Revert "Fix UI getting stuck in Reveal Seed screen"
This reverts commit 2c8156ebe9
.
This commit is contained in:
parent
4544d57f26
commit
477b74124d
@ -102,6 +102,7 @@ ConfigManager.prototype.setShowSeedWords = function (should) {
|
|||||||
this.setData(data)
|
this.setData(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ConfigManager.prototype.getShouldShowSeedWords = function () {
|
ConfigManager.prototype.getShouldShowSeedWords = function () {
|
||||||
var data = this.getData()
|
var data = this.getData()
|
||||||
return data.showSeedWords
|
return data.showSeedWords
|
||||||
@ -117,27 +118,6 @@ ConfigManager.prototype.getSeedWords = function () {
|
|||||||
var data = this.getData()
|
var data = this.getData()
|
||||||
return data.seedWords
|
return data.seedWords
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called to set the isRevealingSeedWords flag. This happens only when the user chooses to reveal
|
|
||||||
* the seed words and not during the first time flow.
|
|
||||||
* @param {boolean} reveal - Value to set the isRevealingSeedWords flag.
|
|
||||||
*/
|
|
||||||
ConfigManager.prototype.setIsRevealingSeedWords = function (reveal = false) {
|
|
||||||
const data = this.getData()
|
|
||||||
data.isRevealingSeedWords = reveal
|
|
||||||
this.setData(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the isRevealingSeedWords flag.
|
|
||||||
* @returns {boolean|undefined}
|
|
||||||
*/
|
|
||||||
ConfigManager.prototype.getIsRevealingSeedWords = function () {
|
|
||||||
const data = this.getData()
|
|
||||||
return data.isRevealingSeedWords
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigManager.prototype.setRpcTarget = function (rpcUrl) {
|
ConfigManager.prototype.setRpcTarget = function (rpcUrl) {
|
||||||
var config = this.getConfig()
|
var config = this.getConfig()
|
||||||
config.provider = {
|
config.provider = {
|
||||||
|
@ -308,7 +308,6 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
lostAccounts: this.configManager.getLostAccounts(),
|
lostAccounts: this.configManager.getLostAccounts(),
|
||||||
seedWords: this.configManager.getSeedWords(),
|
seedWords: this.configManager.getSeedWords(),
|
||||||
forgottenPassword: this.configManager.getPasswordForgotten(),
|
forgottenPassword: this.configManager.getPasswordForgotten(),
|
||||||
isRevealingSeedWords: Boolean(this.configManager.getIsRevealingSeedWords()),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,7 +347,6 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
clearSeedWordCache: this.clearSeedWordCache.bind(this),
|
clearSeedWordCache: this.clearSeedWordCache.bind(this),
|
||||||
resetAccount: nodeify(this.resetAccount, this),
|
resetAccount: nodeify(this.resetAccount, this),
|
||||||
importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
|
importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
|
||||||
setIsRevealingSeedWords: this.configManager.setIsRevealingSeedWords.bind(this.configManager),
|
|
||||||
|
|
||||||
// vault management
|
// vault management
|
||||||
submitPassword: nodeify(keyringController.submitPassword, keyringController),
|
submitPassword: nodeify(keyringController.submitPassword, keyringController),
|
||||||
|
@ -9,7 +9,7 @@ import Identicon from '../../../../ui/app/components/identicon'
|
|||||||
import { confirmSeedWords, showModal } from '../../../../ui/app/actions'
|
import { confirmSeedWords, showModal } from '../../../../ui/app/actions'
|
||||||
import Breadcrumbs from './breadcrumbs'
|
import Breadcrumbs from './breadcrumbs'
|
||||||
import LoadingScreen from './loading-screen'
|
import LoadingScreen from './loading-screen'
|
||||||
import { DEFAULT_ROUTE, INITIALIZE_BACKUP_PHRASE_ROUTE } from '../../../../ui/app/routes'
|
import { DEFAULT_ROUTE } from '../../../../ui/app/routes'
|
||||||
|
|
||||||
class ConfirmSeedScreen extends Component {
|
class ConfirmSeedScreen extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@ -53,7 +53,7 @@ class ConfirmSeedScreen extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { seedWords, history } = this.props
|
const { seedWords } = this.props
|
||||||
const { selectedSeeds, shuffledSeeds } = this.state
|
const { selectedSeeds, shuffledSeeds } = this.state
|
||||||
const isValid = seedWords === selectedSeeds.map(([_, seed]) => seed).join(' ')
|
const isValid = seedWords === selectedSeeds.map(([_, seed]) => seed).join(' ')
|
||||||
|
|
||||||
@ -66,16 +66,6 @@ class ConfirmSeedScreen extends Component {
|
|||||||
<div className="first-view-main-wrapper">
|
<div className="first-view-main-wrapper">
|
||||||
<div className="first-view-main">
|
<div className="first-view-main">
|
||||||
<div className="backup-phrase">
|
<div className="backup-phrase">
|
||||||
<a
|
|
||||||
className="backup-phrase__back-button"
|
|
||||||
onClick={e => {
|
|
||||||
e.preventDefault()
|
|
||||||
history.push(INITIALIZE_BACKUP_PHRASE_ROUTE)
|
|
||||||
}}
|
|
||||||
href="#"
|
|
||||||
>
|
|
||||||
{`< Back`}
|
|
||||||
</a>
|
|
||||||
<Identicon address={this.props.address} diameter={70} />
|
<Identicon address={this.props.address} diameter={70} />
|
||||||
<div className="backup-phrase__content-wrapper">
|
<div className="backup-phrase__content-wrapper">
|
||||||
<div>
|
<div>
|
||||||
|
@ -8,7 +8,6 @@ import Identicon from '../../../../ui/app/components/identicon'
|
|||||||
import Breadcrumbs from './breadcrumbs'
|
import Breadcrumbs from './breadcrumbs'
|
||||||
import LoadingScreen from './loading-screen'
|
import LoadingScreen from './loading-screen'
|
||||||
import { DEFAULT_ROUTE, INITIALIZE_CONFIRM_SEED_ROUTE } from '../../../../ui/app/routes'
|
import { DEFAULT_ROUTE, INITIALIZE_CONFIRM_SEED_ROUTE } from '../../../../ui/app/routes'
|
||||||
import { confirmSeedWords } from '../../../../ui/app/actions'
|
|
||||||
|
|
||||||
const LockIcon = props => (
|
const LockIcon = props => (
|
||||||
<svg
|
<svg
|
||||||
@ -45,8 +44,6 @@ class BackupPhraseScreen extends Component {
|
|||||||
address: PropTypes.string.isRequired,
|
address: PropTypes.string.isRequired,
|
||||||
seedWords: PropTypes.string,
|
seedWords: PropTypes.string,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
isRevealingSeedWords: PropTypes.bool,
|
|
||||||
clearSeedWords: PropTypes.func,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
@ -61,14 +58,6 @@ class BackupPhraseScreen extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
this.checkSeedWords()
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate () {
|
|
||||||
this.checkSeedWords()
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSeedWords () {
|
|
||||||
const { seedWords, history } = this.props
|
const { seedWords, history } = this.props
|
||||||
|
|
||||||
if (!seedWords) {
|
if (!seedWords) {
|
||||||
@ -103,29 +92,9 @@ class BackupPhraseScreen extends Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSubmitButton () {
|
|
||||||
const { isRevealingSeedWords, clearSeedWords, history } = this.props
|
|
||||||
const { isShowingSecret } = this.state
|
|
||||||
|
|
||||||
return isRevealingSeedWords
|
|
||||||
? <button
|
|
||||||
className="first-time-flow__button"
|
|
||||||
onClick={() => clearSeedWords().then(() => history.push(DEFAULT_ROUTE))}
|
|
||||||
disabled={!isShowingSecret}
|
|
||||||
>
|
|
||||||
Done
|
|
||||||
</button>
|
|
||||||
: <button
|
|
||||||
className="first-time-flow__button"
|
|
||||||
onClick={() => isShowingSecret && history.push(INITIALIZE_CONFIRM_SEED_ROUTE)}
|
|
||||||
disabled={!isShowingSecret}
|
|
||||||
>
|
|
||||||
Next
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
|
|
||||||
renderSecretScreen () {
|
renderSecretScreen () {
|
||||||
const { isRevealingSeedWords } = this.props
|
const { isShowingSecret } = this.state
|
||||||
|
const { history } = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="backup-phrase__content-wrapper">
|
<div className="backup-phrase__content-wrapper">
|
||||||
@ -152,8 +121,14 @@ class BackupPhraseScreen extends Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="backup-phrase__next-button">
|
<div className="backup-phrase__next-button">
|
||||||
{ this.renderSubmitButton() }
|
<button
|
||||||
{ !isRevealingSeedWords && <Breadcrumbs total={3} currentIndex={1} />}
|
className="first-time-flow__button"
|
||||||
|
onClick={() => isShowingSecret && history.push(INITIALIZE_CONFIRM_SEED_ROUTE)}
|
||||||
|
disabled={!isShowingSecret}
|
||||||
|
>
|
||||||
|
Next
|
||||||
|
</button>
|
||||||
|
<Breadcrumbs total={3} currentIndex={1} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@ -175,25 +150,13 @@ class BackupPhraseScreen extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = ({ metamask, appState }) => {
|
|
||||||
const { selectedAddress, seedWords, isRevealingSeedWords } = metamask
|
|
||||||
const { isLoading } = appState
|
|
||||||
|
|
||||||
return {
|
|
||||||
seedWords,
|
|
||||||
isRevealingSeedWords,
|
|
||||||
isLoading,
|
|
||||||
address: selectedAddress,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
|
||||||
return {
|
|
||||||
clearSeedWords: () => dispatch(confirmSeedWords()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withRouter,
|
withRouter,
|
||||||
connect(mapStateToProps, mapDispatchToProps),
|
connect(
|
||||||
|
({ metamask: { selectedAddress, seedWords }, appState: { isLoading } }) => ({
|
||||||
|
seedWords,
|
||||||
|
isLoading,
|
||||||
|
address: selectedAddress,
|
||||||
|
})
|
||||||
|
)
|
||||||
)(BackupPhraseScreen)
|
)(BackupPhraseScreen)
|
||||||
|
@ -351,6 +351,7 @@ function confirmSeedWords () {
|
|||||||
log.debug(`background.clearSeedWordCache`)
|
log.debug(`background.clearSeedWordCache`)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
background.clearSeedWordCache((err, account) => {
|
background.clearSeedWordCache((err, account) => {
|
||||||
|
dispatch(actions.hideLoadingIndication())
|
||||||
if (err) {
|
if (err) {
|
||||||
dispatch(actions.displayWarning(err.message))
|
dispatch(actions.displayWarning(err.message))
|
||||||
return reject(err)
|
return reject(err)
|
||||||
@ -361,9 +362,6 @@ function confirmSeedWords () {
|
|||||||
resolve(account)
|
resolve(account)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(() => dispatch(setIsRevealingSeedWords(false)))
|
|
||||||
.then(() => dispatch(actions.hideLoadingIndication()))
|
|
||||||
.catch(() => dispatch(actions.hideLoadingIndication()))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,13 +446,11 @@ function requestRevealSeed (password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispatch(actions.showNewVaultSeed(result))
|
dispatch(actions.showNewVaultSeed(result))
|
||||||
|
dispatch(actions.hideLoadingIndication())
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(() => dispatch(setIsRevealingSeedWords(true)))
|
|
||||||
.then(() => dispatch(actions.hideLoadingIndication()))
|
|
||||||
.catch(() => dispatch(actions.hideLoadingIndication()))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1911,11 +1907,3 @@ function updateNetworkEndpointType (networkEndpointType) {
|
|||||||
value: networkEndpointType,
|
value: networkEndpointType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setIsRevealingSeedWords (reveal) {
|
|
||||||
return dispatch => {
|
|
||||||
log.debug(`background.setIsRevealingSeedWords`)
|
|
||||||
background.setIsRevealingSeedWords(reveal)
|
|
||||||
return forceUpdateMetamaskState(dispatch)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -56,20 +56,11 @@ const {
|
|||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
const {
|
const { currentCurrency, setCurrentCurrencyToUSD } = this.props
|
||||||
currentCurrency,
|
|
||||||
setCurrentCurrencyToUSD,
|
|
||||||
isRevealingSeedWords,
|
|
||||||
clearSeedWords,
|
|
||||||
} = this.props
|
|
||||||
|
|
||||||
if (!currentCurrency) {
|
if (!currentCurrency) {
|
||||||
setCurrentCurrencyToUSD()
|
setCurrentCurrencyToUSD()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRevealingSeedWords) {
|
|
||||||
clearSeedWords()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderRoutes () {
|
renderRoutes () {
|
||||||
@ -402,8 +393,6 @@ App.propTypes = {
|
|||||||
isMouseUser: PropTypes.bool,
|
isMouseUser: PropTypes.bool,
|
||||||
setMouseUserState: PropTypes.func,
|
setMouseUserState: PropTypes.func,
|
||||||
t: PropTypes.func,
|
t: PropTypes.func,
|
||||||
isRevealingSeedWords: PropTypes.bool,
|
|
||||||
clearSeedWords: PropTypes.func,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
@ -484,7 +473,6 @@ function mapDispatchToProps (dispatch, ownProps) {
|
|||||||
setCurrentCurrencyToUSD: () => dispatch(actions.setCurrentCurrency('usd')),
|
setCurrentCurrencyToUSD: () => dispatch(actions.setCurrentCurrency('usd')),
|
||||||
toggleAccountMenu: () => dispatch(actions.toggleAccountMenu()),
|
toggleAccountMenu: () => dispatch(actions.toggleAccountMenu()),
|
||||||
setMouseUserState: (isMouseUser) => dispatch(actions.setMouseUserState(isMouseUser)),
|
setMouseUserState: (isMouseUser) => dispatch(actions.setMouseUserState(isMouseUser)),
|
||||||
clearSeedWords: () => dispatch(actions.confirmSeedWords()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user