Merge pull request #305 from maraoz/optimize/UI-calls

Optimize some UI calls
This commit is contained in:
Matias Alejo Garcia 2014-05-06 19:21:05 -03:00
commit b345242183
3 changed files with 6 additions and 6 deletions

View file

@ -23,7 +23,6 @@ angular.module('copay.header').controller('HeaderController',
$rootScope.$watch('wallet', function(wallet) { $rootScope.$watch('wallet', function(wallet) {
if (wallet) { if (wallet) {
controllerUtils.setSocketHandlers();
} }
}); });
@ -45,8 +44,8 @@ angular.module('copay.header').controller('HeaderController',
$scope.refresh = function() { $scope.refresh = function() {
var w = $rootScope.wallet; var w = $rootScope.wallet;
w.connectToAll();
controllerUtils.updateBalance(function() { controllerUtils.updateBalance(function() {
w.connectToAll();
$rootScope.$digest(); $rootScope.$digest();
}); });
}; };

View file

@ -56,7 +56,6 @@ Wallet.prototype.connectToAll = function() {
this.sendWalletReady(this.firstCopayerId); this.sendWalletReady(this.firstCopayerId);
this.firstCopayerId = null; this.firstCopayerId = null;
} }
this.emit('refresh');
}; };
Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) { Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
@ -206,8 +205,9 @@ Wallet.prototype.netStart = function() {
} }
net.start(startOpts, function() { net.start(startOpts, function() {
self.emit('created', net.getPeer());
self.connectToAll(); self.connectToAll();
self.emit('created', net.getPeer());
self.emit('refresh');
}); });
}; };

View file

@ -59,14 +59,15 @@ angular.module('copay.controllerUtils')
$location.path('addresses'); $location.path('addresses');
}); });
w.on('refresh', function() { w.on('refresh', function() {
root.setSocketHandlers();
root.updateBalance(function() { root.updateBalance(function() {
$rootScope.$digest(); $rootScope.$digest();
}); });
$rootScope.$digest(); $rootScope.$digest();
}); });
w.on('publicKeyRingUpdated', function() { w.on('publicKeyRingUpdated', function() {
root.setSocketHandlers(); root.updateBalance(function() {
$rootScope.$digest();
});
}); });
w.on('openError', root.onErrorDigest); w.on('openError', root.onErrorDigest);
w.on('peer', function(peerID) { w.on('peer', function(peerID) {