Skip to content

Commit

Permalink
Remove NoticeController (#6382)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmashuang authored and whymarrh committed Apr 2, 2019
1 parent 4055dc3 commit a46ec83
Show file tree
Hide file tree
Showing 25 changed files with 77 additions and 1,000 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
32 changes: 32 additions & 0 deletions app/scripts/migrations/033.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// next version number
const version = 33

/*
Cleans up notices and assocated notice controller code
*/

const clone = require('clone')

module.exports = {
version,

migrate: async function (originalVersionedData) {
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
const state = versionedData.data
const newState = transformState(state)
versionedData.data = newState
return versionedData
},
}

function transformState (state) {
const newState = state
// transform state here
if (state.NoticeController) {
delete newState.NoticeController
}
return newState
}
2 changes: 2 additions & 0 deletions app/scripts/migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ module.exports = [
require('./029'),
require('./030'),
require('./031'),
require('./032'),
require('./033'),
]
112 changes: 0 additions & 112 deletions app/scripts/notice-controller.js

This file was deleted.

5 changes: 0 additions & 5 deletions notices/README.md

This file was deleted.

Loading

0 comments on commit a46ec83

Please sign in to comment.