Skip to content

Commit

Permalink
Remove notice-controller and associated code
Browse files Browse the repository at this point in the history
  • Loading branch information
tmashuang committed Apr 1, 2019
1 parent 87f393e commit 04835b1
Show file tree
Hide file tree
Showing 17 changed files with 1 addition and 779 deletions.
1 change: 0 additions & 1 deletion app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 0 additions & 16 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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,
})
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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),
Expand Down
112 changes: 0 additions & 112 deletions app/scripts/notice-controller.js

This file was deleted.

35 changes: 0 additions & 35 deletions notices/notices.js

This file was deleted.

92 changes: 0 additions & 92 deletions test/unit/app/controllers/notice-controller-test.js

This file was deleted.

46 changes: 0 additions & 46 deletions test/unit/ui/app/actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions test/unit/ui/app/reducers/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 04835b1

Please sign in to comment.