From 8a03225cd24d45937fe6e1c7de751784172c1f3c Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Tue, 13 May 2014 05:02:21 -0300 Subject: [PATCH] Alert for transaction support in navbar (red label). Fixes Sign and Reject Transactions. Known bugs: * After 5 continuous transactions, connection is lost with peers * 1-of-1 wallet does not refresh automatically --- index.html | 4 ++-- js/controllers/transactions.js | 9 ++++++--- js/models/core/Wallet.js | 4 ++-- js/services/controllerUtils.js | 10 ++++++++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index b553aa377..486514def 100644 --- a/index.html +++ b/index.html @@ -55,8 +55,8 @@
diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js index 2e083f2ae..26f948cbc 100644 --- a/js/controllers/transactions.js +++ b/js/controllers/transactions.js @@ -16,6 +16,7 @@ angular.module('copay.transactions').controller('TransactionsController', : {type:'error', message: 'There was an error sending the Transaction'} ; controllerUtils.updateTxs(); + $scope.loading = false; $rootScope.$digest(); }); }; @@ -28,15 +29,18 @@ angular.module('copay.transactions').controller('TransactionsController', if (!ret) { $rootScope.flashMessage = {type:'error', message: 'There was an error signing the Transaction'}; controllerUtils.updateTxs(); - $rootScope.$digest(); + $scope.loading = false; + $rootScope.$digest(); return; } var p = w.txProposals.getTxProposal(ntxid); if (p.builder.isFullySigned()) { $scope.send(ntxid); + controllerUtils.updateTxs(); } else { controllerUtils.updateTxs(); + $scope.loading = false; $rootScope.$digest(); } }; @@ -64,8 +68,7 @@ angular.module('copay.transactions').controller('TransactionsController', var w = $rootScope.wallet; w.reject(ntxid); $rootScope.flashMessage = {type:'warning', message: 'Transaction rejected by you'}; - controllerUtils.updateTxs(); -// $rootScope.$digest(); + $scope.loading = false; }; }); diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index 27225bb8a..efae39e0b 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -346,7 +346,7 @@ Wallet.prototype.reject = function(ntxid) { txp.rejectedBy[myId] = Date.now(); this.sendTxProposals(); this.store(); - this.emit('refresh'); + this.emit('txProposalsUpdated'); }; @@ -367,7 +367,7 @@ Wallet.prototype.sign = function(ntxid) { txp.signedBy[myId] = Date.now(); this.sendTxProposals(); this.store(); - this.emit('refresh'); + this.emit('txProposalsUpdated'); return true; } return false; diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index addde1589..e3ad7e0a5 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -85,6 +85,7 @@ angular.module('copay.controllerUtils') w.on('txProposalsUpdated', function() { console.log('[ txProposalsUpdated ]'); //TODO root.updateTxs(); + root.updateBalance(); }); w.on('openError', root.onErrorDigest); w.on('connect', function(peerID) { @@ -153,8 +154,13 @@ angular.module('copay.controllerUtils') txs.push(i); }); $rootScope.txs = txs; -console.log('[controllerUtils.js:155]',txs); //TODO - $rootScope.txslength = txs.length; + var txps = 0; + for(var i=0; i