diff --git a/app/scripts/background.js b/app/scripts/background.js
index 7fea3c8c67b9..cca0d47099a4 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -106,7 +106,6 @@ setupMetamaskMeshMetrics()
* @property {string} rpcTarget - DEPRECATED - The URL of the current RPC provider.
* @property {Object} identities - An object matching lower-case hex addresses to Identity objects with "address" and "name" (nickname) keys.
* @property {Object} unapprovedTxs - An object mapping transaction hashes to unapproved transactions.
- * @property {boolean} noActiveNotices - False if there are notices the user should confirm before using the application.
* @property {Array} frequentRpcList - A list of frequently used RPCs, including custom user-provided ones.
* @property {Array} addressBook - A list of previously sent to addresses.
* @property {address} selectedTokenAddress - Used to indicate if a token is globally selected. Should be deprecated in favor of UI-centric token selection.
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 058d527c09e7..4108ed4c0f35 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -24,7 +24,6 @@ const KeyringController = require('eth-keyring-controller')
const NetworkController = require('./controllers/network')
const PreferencesController = require('./controllers/preferences')
const CurrencyController = require('./controllers/currency')
-const NoticeController = require('./notice-controller')
const ShapeShiftController = require('./controllers/shapeshift')
const InfuraController = require('./controllers/infura')
const BlacklistController = require('./controllers/blacklist')
@@ -211,13 +210,6 @@ module.exports = class MetamaskController extends EventEmitter {
})
this.balancesController.updateAllBalances()
- // notices
- this.noticeController = new NoticeController({
- initState: initState.NoticeController,
- version,
- firstVersion: initState.firstTimeInfo.version,
- })
-
this.shapeshiftController = new ShapeShiftController({
initState: initState.ShapeShiftController,
})
@@ -243,7 +235,6 @@ module.exports = class MetamaskController extends EventEmitter {
PreferencesController: this.preferencesController.store,
AddressBookController: this.addressBookController,
CurrencyController: this.currencyController.store,
- NoticeController: this.noticeController.store,
ShapeShiftController: this.shapeshiftController.store,
NetworkController: this.networkController.store,
InfuraController: this.infuraController.store,
@@ -265,7 +256,6 @@ module.exports = class MetamaskController extends EventEmitter {
RecentBlocksController: this.recentBlocksController.store,
AddressBookController: this.addressBookController,
CurrencyController: this.currencyController.store,
- NoticeController: this.noticeController.memStore,
ShapeshiftController: this.shapeshiftController.store,
InfuraController: this.infuraController.store,
ProviderApprovalController: this.providerApprovalController.store,
@@ -371,7 +361,6 @@ module.exports = class MetamaskController extends EventEmitter {
const keyringController = this.keyringController
const preferencesController = this.preferencesController
const txController = this.txController
- const noticeController = this.noticeController
const networkController = this.networkController
const providerApprovalController = this.providerApprovalController
@@ -470,11 +459,6 @@ module.exports = class MetamaskController extends EventEmitter {
signTypedMessage: nodeify(this.signTypedMessage, this),
cancelTypedMessage: this.cancelTypedMessage.bind(this),
- // notices
- checkNotices: noticeController.updateNoticesList.bind(noticeController),
- markNoticeRead: noticeController.markNoticeRead.bind(noticeController),
- markAllNoticesRead: nodeify(noticeController.markAllNoticesRead, noticeController),
-
approveProviderRequest: providerApprovalController.approveProviderRequest.bind(providerApprovalController),
clearApprovedOrigins: providerApprovalController.clearApprovedOrigins.bind(providerApprovalController),
rejectProviderRequest: providerApprovalController.rejectProviderRequest.bind(providerApprovalController),
diff --git a/app/scripts/notice-controller.js b/app/scripts/notice-controller.js
deleted file mode 100644
index 63b422c5b99a..000000000000
--- a/app/scripts/notice-controller.js
+++ /dev/null
@@ -1,112 +0,0 @@
-const {EventEmitter} = require('events')
-const semver = require('semver')
-const extend = require('xtend')
-const ObservableStore = require('obs-store')
-const hardCodedNotices = require('../../notices/notices.js')
-const uniqBy = require('lodash.uniqby')
-
-module.exports = class NoticeController extends EventEmitter {
-
- constructor (opts = {}) {
- super()
- this.noticePoller = null
- this.firstVersion = opts.firstVersion
- this.version = opts.version
- const initState = extend({
- noticesList: [],
- }, opts.initState)
- this.store = new ObservableStore(initState)
- // setup memStore
- this.memStore = new ObservableStore({})
- this.store.subscribe(() => this._updateMemstore())
- this._updateMemstore()
- // pull in latest notices
- this.updateNoticesList()
- }
-
- getNoticesList () {
- return this.store.getState().noticesList
- }
-
- getUnreadNotices () {
- const notices = this.getNoticesList()
- return notices.filter((notice) => notice.read === false)
- }
-
- getNextUnreadNotice () {
- const unreadNotices = this.getUnreadNotices()
- return unreadNotices[0]
- }
-
- async setNoticesList (noticesList) {
- this.store.updateState({ noticesList })
- return true
- }
-
- markNoticeRead (noticeToMark, cb) {
- cb = cb || function (err) { if (err) throw err }
- try {
- const notices = this.getNoticesList()
- const index = notices.findIndex((currentNotice) => currentNotice.id === noticeToMark.id)
- notices[index].read = true
- notices[index].body = ''
- this.setNoticesList(notices)
- const latestNotice = this.getNextUnreadNotice()
- cb(null, latestNotice)
- } catch (err) {
- cb(err)
- }
- }
-
- markAllNoticesRead () {
- const noticeList = this.getNoticesList()
- noticeList.forEach(notice => {
- notice.read = true
- notice.body = ''
- })
- this.setNoticesList(noticeList)
- const latestNotice = this.getNextUnreadNotice()
- return latestNotice
- }
-
-
- async updateNoticesList () {
- const newNotices = await this._retrieveNoticeData()
- const oldNotices = this.getNoticesList()
- const combinedNotices = this._mergeNotices(oldNotices, newNotices)
- const filteredNotices = this._filterNotices(combinedNotices)
- const result = this.setNoticesList(filteredNotices)
- this._updateMemstore()
- return result
- }
-
- _mergeNotices (oldNotices, newNotices) {
- return uniqBy(oldNotices.concat(newNotices), 'id')
- }
-
- _filterNotices (notices) {
- return notices.filter((newNotice) => {
- if ('version' in newNotice) {
- const satisfied = semver.satisfies(this.version, newNotice.version)
- return satisfied
- }
- if ('firstVersion' in newNotice) {
- const satisfied = semver.satisfies(this.firstVersion, newNotice.firstVersion)
- return satisfied
- }
- return true
- })
- }
-
- async _retrieveNoticeData () {
- // Placeholder for remote notice API.
- return hardCodedNotices
- }
-
- _updateMemstore () {
- const nextUnreadNotice = this.getNextUnreadNotice()
- const noActiveNotices = !nextUnreadNotice
- this.memStore.updateState({ nextUnreadNotice, noActiveNotices })
- }
-
-}
diff --git a/notices/notices.js b/notices/notices.js
deleted file mode 100644
index 6392b6381811..000000000000
--- a/notices/notices.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// fs.readFileSync is inlined by browserify transform "brfs"
-const fs = require('fs')
-const path = require('path')
-
-module.exports = [
- {
- id: 0,
- read: false,
- date: 'Thu Feb 09 2017',
- title: 'Terms of Use',
- body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_0.md'), 'utf8'),
- },
- {
- id: 2,
- read: false,
- date: 'Mon May 08 2017',
- title: 'Privacy Notice',
- body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_2.md'), 'utf8'),
- },
- {
- id: 3,
- read: false,
- date: 'Tue Nov 28 2017',
- title: 'Seed Phrase Alert',
- firstVersion: '<=3.12.0',
- body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_3.md'), 'utf8'),
- },
- {
- id: 4,
- read: false,
- date: 'Wed Jun 13 2018',
- title: 'Phishing Warning',
- body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_4.md'), 'utf8'),
- },
-]
diff --git a/test/unit/app/controllers/notice-controller-test.js b/test/unit/app/controllers/notice-controller-test.js
deleted file mode 100644
index caa50a03ef88..000000000000
--- a/test/unit/app/controllers/notice-controller-test.js
+++ /dev/null
@@ -1,92 +0,0 @@
-const assert = require('assert')
-const NoticeController = require('../../../../app/scripts/notice-controller')
-
-describe('notice-controller', function () {
- var noticeController
-
- beforeEach(function () {
- noticeController = new NoticeController()
- })
-
- describe('notices', function () {
-
- describe('#setNoticesList', function () {
- it('should set data appropriately', function (done) {
- var testList = [{
- id: 0,
- read: false,
- title: 'Futuristic Notice',
- }]
- noticeController.setNoticesList(testList)
- var testListId = noticeController.getNoticesList()[0].id
- assert.equal(testListId, 0)
- done()
- })
- })
-
- describe('#markNoticeRead', function () {
- it('should mark a notice as read', function (done) {
- var testList = [{
- id: 0,
- read: false,
- title: 'Futuristic Notice',
- }]
- noticeController.setNoticesList(testList)
- noticeController.markNoticeRead(testList[0])
- var newList = noticeController.getNoticesList()
- assert.ok(newList[0].read)
- done()
- })
- })
-
- describe('#markAllNoticesRead', () => {
- it('marks all notices read', async () => {
- const testList = [{
- id: 0,
- read: false,
- title: 'Notice 1',
- }, {
- id: 1,
- read: false,
- title: 'Notice 2',
- }, {
- id: 2,
- read: false,
- title: 'Notice 3',
- }]
-
- noticeController.setNoticesList(testList)
-
- noticeController.markAllNoticesRead()
-
- const unreadNotices = noticeController.getUnreadNotices()
- assert.equal(unreadNotices.length, 0)
- })
- })
-
- describe('#getNextUnreadNotice', function () {
- it('should retrieve the latest unread notice', function (done) {
- var testList = [
- {id: 0, read: true, title: 'Past Notice'},
- {id: 1, read: false, title: 'Current Notice'},
- {id: 2, read: false, title: 'Future Notice'},
- ]
- noticeController.setNoticesList(testList)
- var latestUnread = noticeController.getNextUnreadNotice()
- assert.equal(latestUnread.id, 1)
- done()
- })
- it('should return undefined if no unread notices exist.', function (done) {
- var testList = [
- {id: 0, read: true, title: 'Past Notice'},
- {id: 1, read: true, title: 'Current Notice'},
- {id: 2, read: true, title: 'Future Notice'},
- ]
- noticeController.setNoticesList(testList)
- var latestUnread = noticeController.getNextUnreadNotice()
- assert.ok(!latestUnread)
- done()
- })
- })
- })
-})
diff --git a/test/unit/ui/app/actions.spec.js b/test/unit/ui/app/actions.spec.js
index a578ec89cbb1..f45f0d755afa 100644
--- a/test/unit/ui/app/actions.spec.js
+++ b/test/unit/ui/app/actions.spec.js
@@ -1031,52 +1031,6 @@ describe('Actions', () => {
})
})
- describe('#markNoticeRead', () => {
- let markNoticeReadSpy
- const notice = {
- id: 0,
- read: false,
- date: 'test date',
- title: 'test title',
- body: 'test body',
- }
-
- beforeEach(() => {
- markNoticeReadSpy = sinon.stub(background, 'markNoticeRead')
- })
-
- afterEach(() => {
- markNoticeReadSpy.restore()
- })
-
- it('calls markNoticeRead in background', () => {
- const store = mockStore()
-
- store.dispatch(actions.markNoticeRead(notice))
- .then(() => {
- assert(markNoticeReadSpy.calledOnce)
- })
-
- })
-
- it('errors when markNoticeRead in background throws', () => {
- const store = mockStore()
- const expectedActions = [
- { type: 'SHOW_LOADING_INDICATION', value: undefined },
- { type: 'HIDE_LOADING_INDICATION' },
- { type: 'DISPLAY_WARNING', value: 'error' },
- ]
- markNoticeReadSpy.callsFake((notice, callback) => {
- callback(new Error('error'))
- })
-
- store.dispatch(actions.markNoticeRead())
- .catch(() => {
- assert.deepEqual(store.getActions(), expectedActions)
- })
- })
- })
-
describe('#setProviderType', () => {
let setProviderTypeSpy
let store
diff --git a/test/unit/ui/app/reducers/app.spec.js b/test/unit/ui/app/reducers/app.spec.js
index 6c77e0ef9ea9..09cf3dbf007b 100644
--- a/test/unit/ui/app/reducers/app.spec.js
+++ b/test/unit/ui/app/reducers/app.spec.js
@@ -445,15 +445,6 @@ describe('App State', () => {
assert.equal(state.forgottenPassword, false)
})
- it('shows notice', () => {
- const state = reduceApp(metamaskState, {
- type: actions.SHOW_NOTICE,
- })
-
- assert.equal(state.transForward, true)
- assert.equal(state.isLoading, false)
- })
-
it('reveals account', () => {
const state = reduceApp(metamaskState, {
type: actions.REVEAL_ACCOUNT,
diff --git a/test/unit/ui/app/reducers/metamask.spec.js b/test/unit/ui/app/reducers/metamask.spec.js
index 388c67c76fc9..d7876bf39563 100644
--- a/test/unit/ui/app/reducers/metamask.spec.js
+++ b/test/unit/ui/app/reducers/metamask.spec.js
@@ -35,49 +35,6 @@ describe('MetaMask Reducers', () => {
assert.equal(state.isRevealingSeedWords, false)
})
- it('shows notice', () => {
- const notice = {
- id: 0,
- read: false,
- date: 'Date',
- title: 'Title',
- body: 'Body',
- }
-
- const state = reduceMetamask({}, {
- type: actions.SHOW_NOTICE,
- value: notice,
- })
-
- assert.equal(state.noActiveNotices, false)
- assert.equal(state.nextUnreadNotice, notice)
- })
-
- it('clears notice', () => {
-
- const notice = {
- id: 0,
- read: false,
- date: 'Date',
- title: 'Title',
- body: 'Body',
- }
-
- const noticesState = {
- metamask: {
- noActiveNotices: false,
- nextUnreadNotice: notice,
- },
- }
-
- const state = reduceMetamask(noticesState, {
- type: actions.CLEAR_NOTICES,
- })
-
- assert.equal(state.noActiveNotices, true)
- assert.equal(state.nextUnreadNotice, null)
- })
-
it('unlocks MetaMask', () => {
const state = reduceMetamask({}, {
type: actions.UNLOCK_METAMASK,
diff --git a/ui/app/components/app/notice.js b/ui/app/components/app/notice.js
deleted file mode 100644
index bb7e0814c261..000000000000
--- a/ui/app/components/app/notice.js
+++ /dev/null
@@ -1,138 +0,0 @@
-const inherits = require('util').inherits
-const Component = require('react').Component
-const PropTypes = require('prop-types')
-const h = require('react-hyperscript')
-const ReactMarkdown = require('react-markdown')
-const linker = require('extension-link-enabler')
-const findDOMNode = require('react-dom').findDOMNode
-const connect = require('react-redux').connect
-
-Notice.contextTypes = {
- t: PropTypes.func,
-}
-
-module.exports = connect()(Notice)
-
-
-inherits(Notice, Component)
-function Notice () {
- Component.call(this)
-}
-
-Notice.prototype.render = function () {
- const { notice, onConfirm } = this.props
- const { title, date, body } = notice
- const state = this.state || { disclaimerDisabled: true }
- const disabled = state.disclaimerDisabled
-
- return (
- h('.flex-column.flex-center.flex-grow', {
- style: {
- width: '100%',
- },
- }, [
- h('h3.flex-center.text-transform-uppercase.terms-header', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- width: '100%',
- fontSize: '20px',
- textAlign: 'center',
- padding: 6,
- },
- }, [
- title,
- ]),
-
- h('h5.flex-center.text-transform-uppercase.terms-header', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- marginBottom: 24,
- width: '100%',
- fontSize: '20px',
- textAlign: 'center',
- padding: 6,
- },
- }, [
- date,
- ]),
-
- h('style', `
-
- .markdown {
- 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: #df6b0e;
- }
-
- `),
-
- 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: '90%',
- overflowY: 'scroll',
- scroll: 'auto',
- },
- }, [
- h(ReactMarkdown, {
- className: 'notice-box',
- source: body,
- skipHtml: true,
- }),
- ]),
-
- h('button.primary', {
- disabled,
- onClick: () => {
- this.setState({disclaimerDisabled: true}, () => onConfirm())
- },
- style: {
- marginTop: '18px',
- },
- }, this.context.t('accept')),
- ])
- )
-}
-
-Notice.prototype.componentDidMount = function () {
- // eslint-disable-next-line react/no-find-dom-node
- var node = findDOMNode(this)
- linker.setupListener(node)
- if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) {
- this.setState({disclaimerDisabled: false})
- }
-}
-
-Notice.prototype.componentWillUnmount = function () {
- // eslint-disable-next-line react/no-find-dom-node
- var node = findDOMNode(this)
- linker.teardownListener(node)
-}
diff --git a/ui/app/components/app/send/tests/send-selectors-test-data.js b/ui/app/components/app/send/tests/send-selectors-test-data.js
index d43d7c65078d..cff26a191863 100644
--- a/ui/app/components/app/send/tests/send-selectors-test-data.js
+++ b/ui/app/components/app/send/tests/send-selectors-test-data.js
@@ -28,7 +28,6 @@ module.exports = {
'conversionRate': 1200.88200327,
'conversionDate': 1489013762,
'nativeCurrency': 'ETH',
- 'noActiveNotices': true,
'frequentRpcList': [],
'network': '3',
'accounts': {
diff --git a/ui/app/ducks/app/app.js b/ui/app/ducks/app/app.js
index acbb5c9893b2..295507d7050f 100644
--- a/ui/app/ducks/app/app.js
+++ b/ui/app/ducks/app/app.js
@@ -435,12 +435,6 @@ function reduceApp (state, action) {
forgottenPassword: false,
})
- case actions.SHOW_NOTICE:
- return extend(appState, {
- transForward: true,
- isLoading: false,
- })
-
case actions.REVEAL_ACCOUNT:
return extend(appState, {
scrollToBottom: true,
diff --git a/ui/app/ducks/metamask/metamask.js b/ui/app/ducks/metamask/metamask.js
index 864229e839ce..47c767d68f53 100644
--- a/ui/app/ducks/metamask/metamask.js
+++ b/ui/app/ducks/metamask/metamask.js
@@ -18,8 +18,6 @@ function reduceMetamask (state, action) {
rpcTarget: 'https://rawtestrpc.metamask.io/',
identities: {},
unapprovedTxs: {},
- noActiveNotices: true,
- nextUnreadNotice: undefined,
frequentRpcList: [],
addressBook: [],
selectedTokenAddress: null,
@@ -69,18 +67,6 @@ function reduceMetamask (state, action) {
delete newState.seedWords
return newState
- case actions.SHOW_NOTICE:
- return extend(metamaskState, {
- noActiveNotices: false,
- nextUnreadNotice: action.value,
- })
-
- case actions.CLEAR_NOTICES:
- return extend(metamaskState, {
- noActiveNotices: true,
- nextUnreadNotice: undefined,
- })
-
case actions.UPDATE_METAMASK_STATE:
return extend(metamaskState, action.value)
diff --git a/ui/app/helpers/constants/routes.js b/ui/app/helpers/constants/routes.js
index c15027ff4002..df35112d182a 100644
--- a/ui/app/helpers/constants/routes.js
+++ b/ui/app/helpers/constants/routes.js
@@ -19,7 +19,6 @@ const NEW_ACCOUNT_ROUTE = '/new-account'
const IMPORT_ACCOUNT_ROUTE = '/new-account/import'
const CONNECT_HARDWARE_ROUTE = '/new-account/connect'
const SEND_ROUTE = '/send'
-const NOTICE_ROUTE = '/notice'
const WELCOME_ROUTE = '/welcome'
const INITIALIZE_ROUTE = '/initialize'
@@ -29,7 +28,6 @@ const INITIALIZE_CREATE_PASSWORD_ROUTE = '/initialize/create-password'
const INITIALIZE_IMPORT_ACCOUNT_ROUTE = '/initialize/create-password/import-account'
const INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE = '/initialize/create-password/import-with-seed-phrase'
const INITIALIZE_UNIQUE_IMAGE_ROUTE = '/initialize/create-password/unique-image'
-const INITIALIZE_NOTICE_ROUTE = '/initialize/notice'
const INITIALIZE_SELECT_ACTION_ROUTE = '/initialize/select-action'
const INITIALIZE_SEED_PHRASE_ROUTE = '/initialize/seed-phrase'
const INITIALIZE_END_OF_FLOW_ROUTE = '/initialize/end-of-flow'
@@ -62,7 +60,6 @@ module.exports = {
IMPORT_ACCOUNT_ROUTE,
CONNECT_HARDWARE_ROUTE,
SEND_ROUTE,
- NOTICE_ROUTE,
WELCOME_ROUTE,
INITIALIZE_ROUTE,
INITIALIZE_WELCOME_ROUTE,
@@ -71,7 +68,6 @@ module.exports = {
INITIALIZE_IMPORT_ACCOUNT_ROUTE,
INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE,
INITIALIZE_UNIQUE_IMAGE_ROUTE,
- INITIALIZE_NOTICE_ROUTE,
INITIALIZE_SELECT_ACTION_ROUTE,
INITIALIZE_SEED_PHRASE_ROUTE,
INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE,
diff --git a/ui/app/pages/home/home.container.js b/ui/app/pages/home/home.container.js
index 02ec4b9c65e2..7508654dc9f8 100644
--- a/ui/app/pages/home/home.container.js
+++ b/ui/app/pages/home/home.container.js
@@ -7,7 +7,6 @@ import { unconfirmedTransactionsCountSelector } from '../../selectors/confirm-tr
const mapStateToProps = state => {
const { metamask, appState } = state
const {
- noActiveNotices,
lostAccounts,
seedWords,
suggestedTokens,
@@ -16,7 +15,6 @@ const mapStateToProps = state => {
const { forgottenPassword } = appState
return {
- noActiveNotices,
lostAccounts,
forgottenPassword,
seedWords,
diff --git a/ui/app/pages/notice/notice.js b/ui/app/pages/notice/notice.js
deleted file mode 100644
index d8274dfcb55f..000000000000
--- a/ui/app/pages/notice/notice.js
+++ /dev/null
@@ -1,203 +0,0 @@
-const { Component } = require('react')
-const h = require('react-hyperscript')
-const { connect } = require('react-redux')
-const PropTypes = require('prop-types')
-const ReactMarkdown = require('react-markdown')
-const linker = require('extension-link-enabler')
-const generateLostAccountsNotice = require('../../../lib/lost-accounts-notice')
-const findDOMNode = require('react-dom').findDOMNode
-const actions = require('../../store/actions')
-const { DEFAULT_ROUTE } = require('../../helpers/constants/routes')
-
-class Notice extends Component {
- constructor (props) {
- super(props)
-
- this.state = {
- disclaimerDisabled: true,
- }
- }
-
- componentWillMount () {
- if (!this.props.notice) {
- this.props.history.push(DEFAULT_ROUTE)
- }
- }
-
- componentDidMount () {
- // eslint-disable-next-line react/no-find-dom-node
- var node = findDOMNode(this)
- linker.setupListener(node)
- if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) {
- this.setState({ disclaimerDisabled: false })
- }
- }
-
- componentWillReceiveProps (nextProps) {
- if (!nextProps.notice) {
- this.props.history.push(DEFAULT_ROUTE)
- }
- }
-
- componentWillUnmount () {
- // eslint-disable-next-line react/no-find-dom-node
- var node = findDOMNode(this)
- linker.teardownListener(node)
- }
-
- handleAccept () {
- this.setState({ disclaimerDisabled: true })
- this.props.onConfirm()
- }
-
- render () {
- const { notice = {} } = this.props
- const { title, date, body } = notice
- const { disclaimerDisabled } = this.state
-
- return (
- h('.flex-column.flex-center.flex-grow', {
- style: {
- width: '100%',
- },
- }, [
- h('h3.flex-center.text-transform-uppercase.terms-header', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- width: '100%',
- fontSize: '20px',
- textAlign: 'center',
- padding: 6,
- },
- }, [
- title,
- ]),
-
- h('h5.flex-center.text-transform-uppercase.terms-header', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- marginBottom: 24,
- width: '100%',
- fontSize: '20px',
- textAlign: 'center',
- padding: 6,
- },
- }, [
- date,
- ]),
-
- h('style', `
-
- .markdown {
- 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: #df6b0e;
- }
-
- `),
-
- 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: '90%',
- overflowY: 'scroll',
- scroll: 'auto',
- },
- }, [
- h(ReactMarkdown, {
- className: 'notice-box',
- source: body,
- skipHtml: true,
- }),
- ]),
-
- h('button.primary', {
- disabled: disclaimerDisabled,
- onClick: () => this.handleAccept(),
- style: {
- marginTop: '18px',
- },
- }, 'Accept'),
- ])
- )
- }
-
-}
-
-const mapStateToProps = state => {
- const { metamask } = state
- const { noActiveNotices, nextUnreadNotice, lostAccounts } = metamask
-
- return {
- noActiveNotices,
- nextUnreadNotice,
- lostAccounts,
- }
-}
-
-Notice.propTypes = {
- notice: PropTypes.object,
- onConfirm: PropTypes.func,
- history: PropTypes.object,
-}
-
-const mapDispatchToProps = dispatch => {
- return {
- markNoticeRead: nextUnreadNotice => dispatch(actions.markNoticeRead(nextUnreadNotice)),
- markAccountsFound: () => dispatch(actions.markAccountsFound()),
- }
-}
-
-const mergeProps = (stateProps, dispatchProps, ownProps) => {
- const { noActiveNotices, nextUnreadNotice, lostAccounts } = stateProps
- const { markNoticeRead, markAccountsFound } = dispatchProps
-
- let notice
- let onConfirm
-
- if (!noActiveNotices) {
- notice = nextUnreadNotice
- onConfirm = () => markNoticeRead(nextUnreadNotice)
- } else if (lostAccounts && lostAccounts.length > 0) {
- notice = generateLostAccountsNotice(lostAccounts)
- onConfirm = () => markAccountsFound()
- }
-
- return {
- ...stateProps,
- ...dispatchProps,
- ...ownProps,
- notice,
- onConfirm,
- }
-}
-
-module.exports = connect(mapStateToProps, mapDispatchToProps, mergeProps)(Notice)
diff --git a/ui/app/pages/routes/index.js b/ui/app/pages/routes/index.js
index 460cec9584c9..e06d88c90ce5 100644
--- a/ui/app/pages/routes/index.js
+++ b/ui/app/pages/routes/index.js
@@ -31,7 +31,6 @@ const AddTokenPage = require('../add-token')
const ConfirmAddTokenPage = require('../confirm-add-token')
const ConfirmAddSuggestedTokenPage = require('../confirm-add-suggested-token')
const CreateAccountPage = require('../create-account')
-const NoticeScreen = require('../notice/notice')
const Loading = require('../../components/ui/loading-screen')
const LoadingNetwork = require('../../components/app/loading-network-screen').default
@@ -67,7 +66,6 @@ import {
CONFIRM_TRANSACTION_ROUTE,
INITIALIZE_ROUTE,
INITIALIZE_UNLOCK_ROUTE,
- NOTICE_ROUTE,
} from '../../helpers/constants/routes'
// enums
@@ -109,7 +107,6 @@ class Routes extends Component {
-
@@ -322,7 +319,6 @@ Routes.propTypes = {
dispatch: PropTypes.func,
toggleAccountMenu: PropTypes.func,
selectedAddress: PropTypes.string,
- noActiveNotices: PropTypes.bool,
lostAccounts: PropTypes.array,
isInitialized: PropTypes.bool,
forgottenPassword: PropTypes.bool,
@@ -360,10 +356,8 @@ function mapStateToProps (state) {
address,
keyrings,
isInitialized,
- noActiveNotices,
seedWords,
unapprovedTxs,
- nextUnreadNotice,
lostAccounts,
unapprovedMsgCount,
unapprovedPersonalMsgCount,
@@ -380,14 +374,13 @@ function mapStateToProps (state) {
alertMessage,
isLoading,
loadingMessage,
- noActiveNotices,
isInitialized,
isUnlocked: state.metamask.isUnlocked,
selectedAddress: state.metamask.selectedAddress,
currentView: state.appState.currentView,
activeAddress: state.appState.activeAddress,
transForward: state.appState.transForward,
- isOnboarding: Boolean(!noActiveNotices || seedWords || !isInitialized),
+ isOnboarding: Boolean(seedWords || !isInitialized),
isPopup: state.metamask.isPopup,
seedWords: state.metamask.seedWords,
submittedPendingTransactions: submittedPendingTransactionsSelector(state),
@@ -400,7 +393,6 @@ function mapStateToProps (state) {
network: state.metamask.network,
provider: state.metamask.provider,
forgottenPassword: state.appState.forgottenPassword,
- nextUnreadNotice,
lostAccounts,
frequentRpcListDetail: state.metamask.frequentRpcListDetail || [],
currentCurrency: state.metamask.currentCurrency,
diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js
index e5825b5f692a..1f31c0413def 100644
--- a/ui/app/store/actions.js
+++ b/ui/app/store/actions.js
@@ -51,13 +51,6 @@ var actions = {
// remote state
UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE',
updateMetamaskState: updateMetamaskState,
- // notices
- MARK_NOTICE_READ: 'MARK_NOTICE_READ',
- markNoticeRead: markNoticeRead,
- SHOW_NOTICE: 'SHOW_NOTICE',
- showNotice: showNotice,
- CLEAR_NOTICES: 'CLEAR_NOTICES',
- clearNotices: clearNotices,
markAccountsFound,
// intialize screen
CREATE_NEW_VAULT_IN_PROGRESS: 'CREATE_NEW_VAULT_IN_PROGRESS',
@@ -1857,47 +1850,6 @@ function goBackToInitView () {
}
}
-//
-// notice
-//
-
-function markNoticeRead (notice) {
- return (dispatch) => {
- dispatch(actions.showLoadingIndication())
- log.debug(`background.markNoticeRead`)
- return new Promise((resolve, reject) => {
- background.markNoticeRead(notice, (err, notice) => {
- dispatch(actions.hideLoadingIndication())
- if (err) {
- dispatch(actions.displayWarning(err.message))
- return reject(err)
- }
-
- if (notice) {
- dispatch(actions.showNotice(notice))
- resolve(true)
- } else {
- dispatch(actions.clearNotices())
- resolve(false)
- }
- })
- })
- }
-}
-
-function showNotice (notice) {
- return {
- type: actions.SHOW_NOTICE,
- value: notice,
- }
-}
-
-function clearNotices () {
- return {
- type: actions.CLEAR_NOTICES,
- }
-}
-
function markAccountsFound () {
log.debug(`background.markAccountsFound`)
return callBackgroundThenUpdate(background.markAccountsFound)