mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Consolidate notification UI openers (#9885)
* Consolidate notification UI openers * Update tests
This commit is contained in:
parent
70a3a7b09c
commit
5a80f04dca
@ -225,10 +225,7 @@ function setupController(initState, initLangCode) {
|
||||
const controller = new MetamaskController({
|
||||
infuraProjectId: process.env.INFURA_PROJECT_ID,
|
||||
// User confirmation callbacks:
|
||||
showUnconfirmedMessage: triggerUi,
|
||||
showUnapprovedTx: triggerUi,
|
||||
showPermissionRequest: triggerUi,
|
||||
showUnlockRequest: triggerUi,
|
||||
showUserConfirmation: triggerUi,
|
||||
openPopup,
|
||||
// initial state
|
||||
initState,
|
||||
|
@ -150,7 +150,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
isUnlocked: this.isUnlocked.bind(this),
|
||||
initState: initState.AppStateController,
|
||||
onInactiveTimeout: () => this.setLocked(),
|
||||
showUnlockRequest: opts.showUnlockRequest,
|
||||
showUnlockRequest: opts.showUserConfirmation,
|
||||
preferencesStore: this.preferencesController.store,
|
||||
})
|
||||
|
||||
@ -247,7 +247,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
notifyDomain: this.notifyConnections.bind(this),
|
||||
notifyAllDomains: this.notifyAllConnections.bind(this),
|
||||
preferences: this.preferencesController.store,
|
||||
showPermissionRequest: opts.showPermissionRequest,
|
||||
showPermissionRequest: opts.showUserConfirmation,
|
||||
},
|
||||
initState.PermissionsController,
|
||||
initState.PermissionsMetadata,
|
||||
@ -302,7 +302,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
getParticipateInMetrics: () =>
|
||||
this.preferencesController.getParticipateInMetaMetrics(),
|
||||
})
|
||||
this.txController.on('newUnapprovedTx', () => opts.showUnapprovedTx())
|
||||
this.txController.on('newUnapprovedTx', () => opts.showUserConfirmation())
|
||||
|
||||
this.txController.on(`tx:status-update`, async (txId, status) => {
|
||||
if (
|
||||
@ -1376,7 +1376,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
req,
|
||||
)
|
||||
this.sendUpdate()
|
||||
this.opts.showUnconfirmedMessage()
|
||||
this.opts.showUserConfirmation()
|
||||
return promise
|
||||
}
|
||||
|
||||
@ -1439,7 +1439,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
req,
|
||||
)
|
||||
this.sendUpdate()
|
||||
this.opts.showUnconfirmedMessage()
|
||||
this.opts.showUserConfirmation()
|
||||
return promise
|
||||
}
|
||||
|
||||
@ -1498,7 +1498,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
req,
|
||||
)
|
||||
this.sendUpdate()
|
||||
this.opts.showUnconfirmedMessage()
|
||||
this.opts.showUserConfirmation()
|
||||
return promise
|
||||
}
|
||||
|
||||
@ -1590,7 +1590,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
req,
|
||||
)
|
||||
this.sendUpdate()
|
||||
this.opts.showUnconfirmedMessage()
|
||||
this.opts.showUserConfirmation()
|
||||
return promise
|
||||
}
|
||||
|
||||
@ -1655,7 +1655,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
version,
|
||||
)
|
||||
this.sendUpdate()
|
||||
this.opts.showUnconfirmedMessage()
|
||||
this.opts.showUserConfirmation()
|
||||
return promise
|
||||
}
|
||||
|
||||
|
@ -97,8 +97,7 @@ describe('MetaMaskController', function () {
|
||||
.reply(200, '{"JPY":12415.9}')
|
||||
|
||||
metamaskController = new MetaMaskController({
|
||||
showUnapprovedTx: noop,
|
||||
showUnconfirmedMessage: noop,
|
||||
showUserConfirmation: noop,
|
||||
encryptor: {
|
||||
encrypt(_, object) {
|
||||
this.object = object
|
||||
|
@ -44,8 +44,7 @@ describe('Actions', function () {
|
||||
platform: { getVersion: () => 'foo' },
|
||||
provider,
|
||||
keyringController: new KeyringController({}),
|
||||
showUnapprovedTx: noop,
|
||||
showUnconfirmedMessage: noop,
|
||||
showUserConfirmation: noop,
|
||||
encryptor: {
|
||||
encrypt(_, object) {
|
||||
this.object = object
|
||||
|
Loading…
Reference in New Issue
Block a user