From b8e36f41a26f5dfa51b0e10df102bee10b377f6a Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 11 Mar 2016 17:13:48 -0800 Subject: notifications - add tx confirm+cancel buttons --- app/scripts/background.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'app/scripts/background.js') diff --git a/app/scripts/background.js b/app/scripts/background.js index 4567dc656..a724a87e8 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -8,6 +8,7 @@ const EthStore = require('eth-store') const PortStream = require('./lib/port-stream.js') const MetaMaskProvider = require('web3-provider-engine/zero.js') const IdentityStore = require('./lib/idStore') +const createTxNotification = require('./lib/tx-notification.js') console.log('ready to roll') @@ -159,13 +160,13 @@ function updateBadge(state){ // function addUnconfirmedTx(txParams, cb){ - chrome.notifications.create({ - type: 'basic', - iconUrl: '/images/icon-128.png', - title: 'New Transaction', - message: 'click the extension to confirm...', + var txId = idStore.addUnconfirmedTransaction(txParams, cb) + createTxNotification({ + title: 'New Unsigned Transaction', + txParams: txParams, + confirm: idStore.approveTransaction.bind(idStore, txId, noop), + cancel: idStore.cancelTransaction.bind(idStore, txId), }) - idStore.addUnconfirmedTransaction(txParams, cb) } // @@ -204,4 +205,6 @@ function jsonStringifyStream(){ this.push(JSON.stringify(obj)) cb() }) -} \ No newline at end of file +} + +function noop(){} \ No newline at end of file -- cgit