aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2016-06-29 03:36:53 +0800
committerkumavis <aaron@kumavis.me>2016-06-29 03:36:53 +0800
commitc82d7585b824f7617d3765036b2d9d82b49c3493 (patch)
treea9c03144064e366f8629badca36009e79f6aa46b /app
parent621e28f6a2f69739c8963d5f8a1f8acc7002cb28 (diff)
downloadtangerine-wallet-browser-c82d7585b824f7617d3765036b2d9d82b49c3493.tar
tangerine-wallet-browser-c82d7585b824f7617d3765036b2d9d82b49c3493.tar.gz
tangerine-wallet-browser-c82d7585b824f7617d3765036b2d9d82b49c3493.tar.bz2
tangerine-wallet-browser-c82d7585b824f7617d3765036b2d9d82b49c3493.tar.lz
tangerine-wallet-browser-c82d7585b824f7617d3765036b2d9d82b49c3493.tar.xz
tangerine-wallet-browser-c82d7585b824f7617d3765036b2d9d82b49c3493.tar.zst
tangerine-wallet-browser-c82d7585b824f7617d3765036b2d9d82b49c3493.zip
background - prepare state for notifcations
Diffstat (limited to 'app')
-rw-r--r--app/scripts/background.js32
-rw-r--r--app/scripts/lib/notifications.js40
2 files changed, 28 insertions, 44 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 97e3269ba..7ffbe5c41 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -30,21 +30,37 @@ function unlockAccountMessage () {
}
function showUnconfirmedMessage (msgParams, msgId) {
+ var controllerState = controller.getState()
+
createMsgNotification({
- title: 'New Unsigned Message',
- msgParams: msgParams,
- confirm: idStore.approveMessage.bind(idStore, msgId, noop),
- cancel: idStore.cancelMessage.bind(idStore, msgId),
+ imageifyIdenticons: false,
+ txData: {
+ msgParams: opts.msgParams,
+ time: (new Date()).getTime(),
+ },
+ identities: controllerState.identities,
+ accounts: controllerState.accounts,
+ onConfirm: idStore.approveMessage.bind(idStore, msgId, noop),
+ onCancel: idStore.cancelMessage.bind(idStore, msgId),
})
+
}
function showUnconfirmedTx (txParams, txData, onTxDoneCb) {
+ var controllerState = controller.getState()
+
createTxNotification({
- title: 'New Unsigned Transaction',
- txParams: txParams,
- confirm: idStore.approveTransaction.bind(idStore, txData.id, noop),
- cancel: idStore.cancelTransaction.bind(idStore, txData.id),
+ imageifyIdenticons: false,
+ txData: {
+ txParams: txParams,
+ time: (new Date()).getTime(),
+ },
+ identities: controllerState.identities,
+ accounts: controllerState.accounts,
+ onConfirm: idStore.approveTransaction.bind(idStore, txData.id, noop),
+ onCancel: idStore.cancelTransaction.bind(idStore, txData.id),
})
+
}
//
diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js
index 2a058db75..2f97f22ac 100644
--- a/app/scripts/lib/notifications.js
+++ b/app/scripts/lib/notifications.js
@@ -53,62 +53,30 @@ function createUnlockRequestNotification (opts) {
})
}
-function createTxNotification (opts) {
+function createTxNotification (state) {
// guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236
if (!chrome.notifications) return console.error('Chrome notifications API missing...')
- var state = {
- title: 'New Unsigned Transaction',
- imageifyIdenticons: false,
- txData: {
- txParams: opts.txParams,
- time: (new Date()).getTime(),
- },
- identities: {
-
- },
- accounts: {
-
- },
- onConfirm: opts.confirm,
- onCancel: opts.cancel,
- }
-
renderTxNotificationSVG(state, function(err, notificationSvgSource){
if (err) throw err
showNotification(extend(state, {
+ title: 'New Unsigned Transaction',
imageUrl: toSvgUri(notificationSvgSource),
}))
})
}
-function createMsgNotification (opts) {
+function createMsgNotification (state) {
// guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236
if (!chrome.notifications) return console.error('Chrome notifications API missing...')
- var state = {
- title: 'New Unsigned Message',
- imageifyIdenticons: false,
- txData: {
- msgParams: opts.msgParams,
- time: (new Date()).getTime(),
- },
- identities: {
-
- },
- accounts: {
-
- },
- onConfirm: opts.confirm,
- onCancel: opts.cancel,
- }
-
renderMsgNotificationSVG(state, function(err, notificationSvgSource){
if (err) throw err
showNotification(extend(state, {
+ title: 'New Unsigned Message',
imageUrl: toSvgUri(notificationSvgSource),
}))