fix add icon flicker in addressbook view

This commit is contained in:
Gabriel Bazán 2017-02-21 15:33:50 -05:00
commit d52509b64d
2 changed files with 10 additions and 6 deletions

View file

@ -3,7 +3,6 @@
angular.module('copayApp.controllers').controller('addressbookListController', function($scope, $log, $timeout, addressbookService, lodash, popupService, gettextCatalog, platformInfo) {
var contacts;
$scope.isChromeApp = platformInfo.isChromeApp;
var initAddressbook = function() {
addressbookService.list(function(err, ab) {
@ -11,6 +10,9 @@ angular.module('copayApp.controllers').controller('addressbookListController', f
$scope.isEmptyList = lodash.isEmpty(ab);
if (!$scope.isEmptyList) $scope.showAddIcon = true;
else $scope.showAddIcon = false;
contacts = [];
lodash.each(ab, function(v, k) {
contacts.push({
@ -23,7 +25,7 @@ angular.module('copayApp.controllers').controller('addressbookListController', f
$scope.addressbook = lodash.clone(contacts);
$timeout(function() {
$scope.$apply();
}, 100);
});
});
};
@ -58,6 +60,8 @@ angular.module('copayApp.controllers').controller('addressbookListController', f
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.isChromeApp = platformInfo.isChromeApp;
$scope.showAddIcon = false;
initAddressbook();
});