From 65c84ac4b2a8a4355bff63690d34e52a4a45a561 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 9 Feb 2017 18:17:50 -0800 Subject: Delete all code related to disclaimers. --- ui/app/actions.js | 19 ------- ui/app/app.js | 32 +++++------- ui/app/first-time/disclaimer.js | 112 ---------------------------------------- ui/app/reducers/metamask.js | 5 -- 4 files changed, 13 insertions(+), 155 deletions(-) delete mode 100644 ui/app/first-time/disclaimer.js (limited to 'ui') diff --git a/ui/app/actions.js b/ui/app/actions.js index 65e5add8c..6552e7f5c 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -22,8 +22,6 @@ var actions = { clearNotices: clearNotices, markAccountsFound, // intialize screen - AGREE_TO_DISCLAIMER: 'AGREE_TO_DISCLAIMER', - agreeToDisclaimer: agreeToDisclaimer, CREATE_NEW_VAULT_IN_PROGRESS: 'CREATE_NEW_VAULT_IN_PROGRESS', SHOW_CREATE_VAULT: 'SHOW_CREATE_VAULT', SHOW_RESTORE_VAULT: 'SHOW_RESTORE_VAULT', @@ -450,23 +448,6 @@ function showImportPage () { } } -function agreeToDisclaimer () { - return (dispatch) => { - dispatch(this.showLoadingIndication()) - if (global.METAMASK_DEBUG) console.log(`background.agreeToDisclaimer`) - background.agreeToDisclaimer((err) => { - if (err) { - return dispatch(actions.displayWarning(err.message)) - } - - dispatch(this.hideLoadingIndication()) - dispatch({ - type: this.AGREE_TO_DISCLAIMER, - }) - }) - } -} - function createNewVaultInProgress () { return { type: actions.CREATE_NEW_VAULT_IN_PROGRESS, diff --git a/ui/app/app.js b/ui/app/app.js index 3bc4897c8..e75a4e72f 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -5,7 +5,6 @@ const h = require('react-hyperscript') const actions = require('./actions') const ReactCSSTransitionGroup = require('react-addons-css-transition-group') // init -const DisclaimerScreen = require('./first-time/disclaimer') const InitializeMenuScreen = require('./first-time/init-menu') const NewKeyChainScreen = require('./new-keychain') // unlock @@ -44,7 +43,6 @@ function mapStateToProps (state) { // state from plugin isLoading: state.appState.isLoading, loadingMessage: state.appState.loadingMessage, - isDisclaimerConfirmed: state.metamask.isDisclaimerConfirmed, noActiveNotices: state.metamask.noActiveNotices, isInitialized: state.metamask.isInitialized, isUnlocked: state.metamask.isUnlocked, @@ -351,8 +349,19 @@ App.prototype.renderBackButton = function (style, justArrow = false) { App.prototype.renderPrimary = function () { var props = this.props - if (!props.isDisclaimerConfirmed) { - return h(DisclaimerScreen, {key: 'disclaimerScreen'}) + // notices + if (!props.noActiveNotices) { + return h(NoticeScreen, { + notice: props.lastUnreadNotice, + key: 'NoticeScreen', + onConfirm: () => props.dispatch(actions.markNoticeRead(props.lastUnreadNotice)), + }) + } else if (props.lostAccounts && props.lostAccounts.length > 0) { + return h(NoticeScreen, { + notice: generateLostAccountsNotice(props.lostAccounts), + key: 'LostAccountsNotice', + onConfirm: () => props.dispatch(actions.markAccountsFound()), + }) } if (props.seedWords) { @@ -384,21 +393,6 @@ App.prototype.renderPrimary = function () { } } - // notices - if (!props.noActiveNotices) { - return h(NoticeScreen, { - notice: props.lastUnreadNotice, - key: 'NoticeScreen', - onConfirm: () => props.dispatch(actions.markNoticeRead(props.lastUnreadNotice)), - }) - } else if (props.lostAccounts && props.lostAccounts.length > 0) { - return h(NoticeScreen, { - notice: generateLostAccountsNotice(props.lostAccounts), - key: 'LostAccountsNotice', - onConfirm: () => props.dispatch(actions.markAccountsFound()), - }) - } - // show current view switch (props.currentView.name) { diff --git a/ui/app/first-time/disclaimer.js b/ui/app/first-time/disclaimer.js deleted file mode 100644 index a8bafd39b..000000000 --- a/ui/app/first-time/disclaimer.js +++ /dev/null @@ -1,112 +0,0 @@ -const inherits = require('util').inherits -const Component = require('react').Component -const h = require('react-hyperscript') -const connect = require('react-redux').connect -const actions = require('../actions') -const ReactMarkdown = require('react-markdown') -const fs = require('fs') -const path = require('path') -const linker = require('extension-link-enabler') -const findDOMNode = require('react-dom').findDOMNode -const disclaimer = fs.readFileSync(path.join(__dirname, '..', '..', '..', 'USER_AGREEMENT.md')).toString() -module.exports = connect(mapStateToProps)(DisclaimerScreen) - -function mapStateToProps (state) { - return {} -} - -inherits(DisclaimerScreen, Component) -function DisclaimerScreen () { - Component.call(this) -} - -DisclaimerScreen.prototype.render = function () { - const state = this.state || {disclaimerDisabled: true} - const disabled = state.disclaimerDisabled - - return ( - h('.flex-column.flex-center.flex-grow', [ - - h('h3.flex-center.text-transform-uppercase.terms-header', { - style: { - background: '#EBEBEB', - color: '#AEAEAE', - marginBottom: 24, - width: '100%', - fontSize: '20px', - textAlign: 'center', - padding: 6, - }, - }, [ - 'MetaMask Terms & Conditions', - ]), - - h('style', ` - - .markdown { - font-family: Times New Roman; - overflow-x: hidden; - } - .markdown h1, .markdown h2, .markdown h3 { - margin: 10px 0; - font-weight: bold; - } - - .markdown strong { - font-weight: bold; - } - .markdown em { - font-style: italic; - } - - .markdown p { - margin: 10px 0; - } - - .markdown a { - color: blue; - } - - `), - - h('div.markdown', { - onScroll: (e) => { - var object = e.currentTarget - if (object.offsetHeight + object.scrollTop + 100 >= object.scrollHeight) { - this.setState({disclaimerDisabled: false}) - } - }, - style: { - background: 'rgb(235, 235, 235)', - height: '310px', - padding: '6px', - width: '80%', - overflowY: 'scroll', - }, - }, [ - - h(ReactMarkdown, { - source: disclaimer, - skipHtml: true, - }), - - ]), - - h('button', { - style: { marginTop: '18px' }, - disabled, - onClick: () => this.props.dispatch(actions.agreeToDisclaimer()), - }, disabled ? 'Scroll Down to Enable' : 'I Agree'), - ]) - ) -} - -DisclaimerScreen.prototype.componentDidMount = function () { - var node = findDOMNode(this) - linker.setupListener(node) -} - -DisclaimerScreen.prototype.componentWillUnmount = function () { - var node = findDOMNode(this) - linker.teardownListener(node) -} diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index 4f13c1ab1..3875cf6d1 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -41,11 +41,6 @@ function reduceMetamask (state, action) { case actions.UPDATE_METAMASK_STATE: return extend(metamaskState, action.value) - case actions.AGREE_TO_DISCLAIMER: - return extend(metamaskState, { - isDisclaimerConfirmed: true, - }) - case actions.UNLOCK_METAMASK: return extend(metamaskState, { isUnlocked: true, -- cgit