aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/background.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/background.js')
-rw-r--r--app/scripts/background.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 7cb25d8bf..ca2efc114 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -17,13 +17,13 @@ const controller = new MetamaskController({
// User confirmation callbacks:
showUnconfirmedMessage: triggerUi,
unlockAccountMessage: triggerUi,
- showUnconfirmedTx: triggerUi,
+ showUnapprovedTx: triggerUi,
// Persistence Methods:
setData,
loadData,
})
const keyringController = controller.keyringController
-
+const txManager = controller.txManager
function triggerUi () {
if (!popupIsOpen) notification.show()
}
@@ -97,15 +97,14 @@ function setupControllerConnection (stream) {
// plugin badge text
//
-keyringController.on('update', updateBadge)
+txManager.on('updateBadge', updateBadge)
function updateBadge () {
var label = ''
- var unconfTxs = controller.configManager.unconfirmedTxs()
- var unconfTxLen = Object.keys(unconfTxs).length
+ var unapprovedTxCount = controller.txManager.unapprovedTxCount
var unconfMsgs = messageManager.unconfirmedMsgs()
var unconfMsgLen = Object.keys(unconfMsgs).length
- var count = unconfTxLen + unconfMsgLen
+ var count = unapprovedTxCount + unconfMsgLen
if (count) {
label = String(count)
}
@@ -113,6 +112,8 @@ function updateBadge () {
extension.browserAction.setBadgeBackgroundColor({ color: '#506F8B' })
}
+// data :: setters/getters
+
function loadData () {
var oldData = getOldStyleData()
var newData