diff --git a/ui/app/helpers/constants/routes.js b/ui/app/helpers/constants/routes.js index efd09c151..4824a9b13 100644 --- a/ui/app/helpers/constants/routes.js +++ b/ui/app/helpers/constants/routes.js @@ -1,6 +1,5 @@ const DEFAULT_ROUTE = '/' const UNLOCK_ROUTE = '/unlock' -const LOCK_ROUTE = '/lock' const ASSET_ROUTE = '/asset' const SETTINGS_ROUTE = '/settings' const GENERAL_ROUTE = '/settings/general' @@ -68,7 +67,6 @@ const ENCRYPTION_PUBLIC_KEY_REQUEST_PATH = '/encryption-public-key-request' const PATH_NAME_MAP = { [DEFAULT_ROUTE]: 'Home', [UNLOCK_ROUTE]: 'Unlock Page', - [LOCK_ROUTE]: 'Lock Page', [`${ASSET_ROUTE}/:asset`]: `Asset Page`, [SETTINGS_ROUTE]: 'Settings Page', [GENERAL_ROUTE]: 'General Settings Page', @@ -135,7 +133,6 @@ export { ALERTS_ROUTE, ASSET_ROUTE, UNLOCK_ROUTE, - LOCK_ROUTE, SETTINGS_ROUTE, REVEAL_SEED_ROUTE, MOBILE_SYNC_ROUTE, diff --git a/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.component.js b/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.component.js index 54503bf1d..278137084 100644 --- a/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.component.js +++ b/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.component.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types' import { Redirect } from 'react-router-dom' import { DEFAULT_ROUTE, - LOCK_ROUTE, INITIALIZE_WELCOME_ROUTE, INITIALIZE_UNLOCK_ROUTE, } from '../../../helpers/constants/routes' @@ -22,10 +21,6 @@ export default class FirstTimeFlowSwitch extends PureComponent { return } - if (isUnlocked) { - return - } - if (!isInitialized) { return } diff --git a/ui/app/pages/first-time-flow/first-time-flow-switch/tests/first-time-flow-switch.test.js b/ui/app/pages/first-time-flow/first-time-flow-switch/tests/first-time-flow-switch.test.js index 98a0f1103..950f87e94 100644 --- a/ui/app/pages/first-time-flow/first-time-flow-switch/tests/first-time-flow-switch.test.js +++ b/ui/app/pages/first-time-flow/first-time-flow-switch/tests/first-time-flow-switch.test.js @@ -3,7 +3,6 @@ import React from 'react' import { mountWithRouter } from '../../../../../../test/lib/render-helpers' import { DEFAULT_ROUTE, - LOCK_ROUTE, INITIALIZE_WELCOME_ROUTE, INITIALIZE_UNLOCK_ROUTE, } from '../../../../helpers/constants/routes' @@ -35,22 +34,6 @@ describe('FirstTimeFlowSwitch', function () { ) }) - it('redirects to /lock route when isUnlocked is true ', function () { - const props = { - completedOnboarding: false, - isUnlocked: true, - } - - const wrapper = mountWithRouter( - , - ) - - assert.equal( - wrapper.find('Lifecycle').find({ to: { pathname: LOCK_ROUTE } }).length, - 1, - ) - }) - it('redirects to /welcome route when isInitialized is false', function () { const props = { completedOnboarding: false, diff --git a/ui/app/pages/lock/index.js b/ui/app/pages/lock/index.js deleted file mode 100644 index 7bfe2a61f..000000000 --- a/ui/app/pages/lock/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './lock.container' diff --git a/ui/app/pages/lock/lock.component.js b/ui/app/pages/lock/lock.component.js deleted file mode 100644 index a415f5b55..000000000 --- a/ui/app/pages/lock/lock.component.js +++ /dev/null @@ -1,26 +0,0 @@ -import React, { PureComponent } from 'react' -import PropTypes from 'prop-types' -import Loading from '../../components/ui/loading-screen' -import { DEFAULT_ROUTE } from '../../helpers/constants/routes' - -export default class Lock extends PureComponent { - static propTypes = { - history: PropTypes.object, - isUnlocked: PropTypes.bool, - lockMetamask: PropTypes.func, - } - - componentDidMount() { - const { lockMetamask, isUnlocked, history } = this.props - - if (isUnlocked) { - lockMetamask().then(() => history.push(DEFAULT_ROUTE)) - } else { - history.replace(DEFAULT_ROUTE) - } - } - - render() { - return - } -} diff --git a/ui/app/pages/lock/lock.container.js b/ui/app/pages/lock/lock.container.js deleted file mode 100644 index b1da86f67..000000000 --- a/ui/app/pages/lock/lock.container.js +++ /dev/null @@ -1,26 +0,0 @@ -import { compose } from 'redux' -import { connect } from 'react-redux' -import { withRouter } from 'react-router-dom' -import { lockMetamask } from '../../store/actions' -import Lock from './lock.component' - -const mapStateToProps = (state) => { - const { - metamask: { isUnlocked }, - } = state - - return { - isUnlocked, - } -} - -const mapDispatchToProps = (dispatch) => { - return { - lockMetamask: () => dispatch(lockMetamask()), - } -} - -export default compose( - withRouter, - connect(mapStateToProps, mapDispatchToProps), -)(Lock) diff --git a/ui/app/pages/lock/tests/lock.test.js b/ui/app/pages/lock/tests/lock.test.js deleted file mode 100644 index 92a46af6e..000000000 --- a/ui/app/pages/lock/tests/lock.test.js +++ /dev/null @@ -1,40 +0,0 @@ -import assert from 'assert' -import React from 'react' -import sinon from 'sinon' -import { mountWithRouter } from '../../../../../test/lib/render-helpers' -import Lock from '..' - -describe('Lock', function () { - it('replaces history with default route when isUnlocked false', function () { - const props = { - isUnlocked: false, - history: { - replace: sinon.spy(), - }, - } - - mountWithRouter() - - assert.equal(props.history.replace.getCall(0).args[0], '/') - }) - - it('locks and pushes history with default route when isUnlocked true', function (done) { - const props = { - isUnlocked: true, - lockMetamask: sinon.stub(), - history: { - push: sinon.spy(), - }, - } - - props.lockMetamask.resolves() - - mountWithRouter() - - assert(props.lockMetamask.calledOnce) - setImmediate(() => { - assert.equal(props.history.push.getCall(0).args[0], '/') - done() - }) - }) -}) diff --git a/ui/app/pages/routes/routes.component.js b/ui/app/pages/routes/routes.component.js index 44676b868..9a1fee342 100644 --- a/ui/app/pages/routes/routes.component.js +++ b/ui/app/pages/routes/routes.component.js @@ -13,7 +13,6 @@ import Home from '../home' import Settings from '../settings' import Authenticated from '../../helpers/higher-order-components/authenticated' import Initialized from '../../helpers/higher-order-components/initialized' -import Lock from '../lock' import PermissionsConnect from '../permissions-connect' import RestoreVaultPage from '../keychains/restore-vault' import RevealSeedConfirmation from '../keychains/reveal-seed' @@ -43,7 +42,6 @@ import { DEFAULT_ROUTE, INITIALIZE_ROUTE, INITIALIZE_UNLOCK_ROUTE, - LOCK_ROUTE, MOBILE_SYNC_ROUTE, NEW_ACCOUNT_ROUTE, RESTORE_VAULT_ROUTE, @@ -113,7 +111,6 @@ export default class Routes extends Component { const routes = ( -