From b73f711fffd7f296a6868231148c1afea13c3ee7 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Sun, 30 Nov 2014 11:08:51 -0300 Subject: [PATCH] adds pending txs service --- js/controllers/send.js | 5 ++--- js/controllers/sidebar.js | 7 ++++--- js/services/pendingTxsService.js | 6 +++++- views/profile.html | 7 +++++++ views/send.html | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/js/controllers/send.js b/js/controllers/send.js index 4b98044e7..6ae640601 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -55,8 +55,6 @@ angular.module('copayApp.controllers').controller('SendController', } }); $scope.txps = res.txs; -// TODO -// $rootScope.pendingTxCount = res.pendingForUs; }; /** @@ -100,7 +98,8 @@ angular.module('copayApp.controllers').controller('SendController', }); - $scope.loadTxs = function() { + $scope.init = function() { + $rootScope.pendingTxCount = 0; $scope.updateTxs(); setTimeout(function() { $scope.loading = false; diff --git a/js/controllers/sidebar.js b/js/controllers/sidebar.js index 63a1d208e..5da6e83ab 100644 --- a/js/controllers/sidebar.js +++ b/js/controllers/sidebar.js @@ -46,8 +46,9 @@ angular.module('copayApp.controllers').controller('SidebarController', function( $scope.init = function() { - - // Change focused wallet + // This should be called only once. + + // focused wallet change if ($rootScope.wallet) { $rootScope.$watch('wallet', function() { $scope.walletSelection = false; @@ -55,7 +56,7 @@ angular.module('copayApp.controllers').controller('SidebarController', function( }); } - // Change wallet list + // wallet list chane if ($rootScope.iden) { var iden = $rootScope.iden; iden.on('newWallet', function() { diff --git a/js/services/pendingTxsService.js b/js/services/pendingTxsService.js index 9e9ab08b9..59a60409a 100644 --- a/js/services/pendingTxsService.js +++ b/js/services/pendingTxsService.js @@ -5,7 +5,11 @@ angular.module('copayApp.services') .factory('pendingTxsService', function($rootScope, $sce, $location, $filter, notification, $timeout, rateService) { var root = {}; root.update = function(w) { -console.log('[pendingTxsService.js.8] TODO updade pending Txs'); //TODO + var w = $rootScope.wallet; + if (!w) return; + + var res = w.getPendingTxProposals(); + $rootScope.pendingTxCount = res.pendingForUs; }; return root; }); diff --git a/views/profile.html b/views/profile.html index e1b1ebea2..f809c7f4c 100644 --- a/views/profile.html +++ b/views/profile.html @@ -49,6 +49,7 @@ Type Status Balance + Approx Size Actions @@ -69,6 +70,12 @@ {{item.balanceInfo.totalBalance || 0 |noFractionNumber}} {{item.settings.unitName}} + + + {{item.sizes().total/1000}} kB + + +
+

Pending Transactions Proposals