Merge pull request #3381 from cmgustavo/feat/addressbook-03
Addressbook variable is updated only if it is modified
This commit is contained in:
commit
e715f2ecd3
2 changed files with 11 additions and 5 deletions
|
|
@ -1011,7 +1011,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setAddressbook = function() {
|
self.setAddressbook = function(ab) {
|
||||||
|
if (ab) {
|
||||||
|
self.addressbook = ab;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
addressbookService.list(function(err, ab) {
|
addressbookService.list(function(err, ab) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$log.error('Error getting the addressbook');
|
$log.error('Error getting the addressbook');
|
||||||
|
|
@ -1027,8 +1032,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.updateHistory();
|
self.updateHistory();
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('Local/AddressbookUpdated', function(event) {
|
$rootScope.$on('Local/AddressbookUpdated', function(event, ab) {
|
||||||
self.setAddressbook();
|
self.setAddressbook(ab);
|
||||||
});
|
});
|
||||||
|
|
||||||
// UX event handlers
|
// UX event handlers
|
||||||
|
|
@ -1286,4 +1291,4 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.setFocusedWallet();
|
self.setFocusedWallet();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
$scope.error = err;
|
$scope.error = err;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$rootScope.$emit('Local/AddressbookUpdated', ab);
|
||||||
$scope.list = ab;
|
$scope.list = ab;
|
||||||
$scope.editAddressbook = true;
|
$scope.editAddressbook = true;
|
||||||
$scope.toggleEditAddressbook();
|
$scope.toggleEditAddressbook();
|
||||||
|
|
@ -230,6 +231,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
$scope.error = err;
|
$scope.error = err;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$rootScope.$emit('Local/AddressbookUpdated', ab);
|
||||||
$scope.list = ab;
|
$scope.list = ab;
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
});
|
});
|
||||||
|
|
@ -272,7 +274,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
|
|
||||||
modalInstance.result.finally(function() {
|
modalInstance.result.finally(function() {
|
||||||
$rootScope.modalOpened = false;
|
$rootScope.modalOpened = false;
|
||||||
$rootScope.$emit('Local/AddressbookUpdated');
|
|
||||||
disableCloseModal();
|
disableCloseModal();
|
||||||
var m = angular.element(document.getElementsByClassName('reveal-modal'));
|
var m = angular.element(document.getElementsByClassName('reveal-modal'));
|
||||||
m.addClass(animationService.modalAnimated.slideOutDown);
|
m.addClass(animationService.modalAnimated.slideOutDown);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue