From b32b29259a364133a523159502cd2c6ff159dcb2 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 29 May 2015 12:39:17 -0300 Subject: [PATCH] fix refreshUntilItChanges --- src/js/controllers/index.js | 12 ++++++++---- src/js/controllers/walletHome.js | 14 +++++++++----- src/js/services/notificationsService.js | 7 +++++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 75eff1ee5..9378e3cfb 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -185,12 +185,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r $timeout(function() { self.setOngoingProcess('updatingStatus', true); - $log.debug('Updating Status:', fc); + $log.debug('Updating Status:', fc, tries); get(function(err, walletStatus) { - if (!err && untilItChanges && initBalance == walletStatus.balance.totalAmount && tries < 10) { + if (!err && untilItChanges && initBalance == walletStatus.balance.totalAmount && tries < 7) { return $timeout(function() { return self.updateAll(null, true, initBalance, ++tries); - }, 1000); + }, 1400 * tries); } self.setOngoingProcess('updatingStatus', false); if (err) { @@ -709,7 +709,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r }, 5000); }); - lodash.each(['NewOutgoingTx', 'NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved', + $rootScope.$on('NewOutgoingTx', function() { + self.updateAll(null, true); + }); + + lodash.each(['NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved', 'Local/NewTxProposal', 'Local/TxProposalAction', 'ScanFinished' ], function(eventName) { $rootScope.$on(eventName, function(event, untilItChanges) { diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 7e725f2c1..93f0e2795 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -223,8 +223,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi if (memo) $log.info(memo); - console.log('[walletHome.js.223]'); //TODO - $modalInstance.close(txpsb, true); + txpsb.refreshUntilItChanges = true; + $modalInstance.close(txpsb); } }); } else { @@ -293,7 +293,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi if (memo) $log.info(memo); - $modalInstance.close(txpb, true); + + txpb.refreshUntilItChanges = true; + $modalInstance.close(txpb); } }); }, 100); @@ -320,7 +322,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi m.addClass('slideOutRight'); }); - modalInstance.result.then(function(txp, refreshUntilItChanges) { + modalInstance.result.then(function(txp) { + var refreshUntilItChanges = txp.refreshUntilItChanges; + console.log('[walletHome.js.323:refreshUntilItChanges:]', refreshUntilItChanges); //TODO self.setOngoingProcess(); if (txp) { txStatus.notify(txp, function() { @@ -421,7 +425,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi }; this.resetError = function() { - this.error = this.success = null; + this.error = this.success = null; }; this.bindTouchDown = function(tries) { diff --git a/src/js/services/notificationsService.js b/src/js/services/notificationsService.js index 986ed3e24..029d2d2ca 100644 --- a/src/js/services/notificationsService.js +++ b/src/js/services/notificationsService.js @@ -15,6 +15,10 @@ angular.module('copayApp.services') }; root.storeLast = function(notificationData, walletId) { + + if (notificationData.type == 'NewAddress') + return; + lastNotificationOnWallet[walletId] = { creatorId: notificationData.creatorId, type: notificationData.type, @@ -38,7 +42,6 @@ angular.module('copayApp.services') && notificationData.type === 'TxProposalFinallyRejected') return true; - return false; }; @@ -73,7 +76,7 @@ angular.module('copayApp.services') name, {color: color} ); break; case 'NewOutgoingTx': - notification.sent(gettext('Payment Proposal Sent'), + notification.sent(gettext('Payment Sent'), name, {color: color} ); break; case 'NewIncomingTx':