Merge pull request #5702 from gabrielbazan7/fix/flickersend

fix flash when entering send tab view
This commit is contained in:
Gustavo Maximiliano Cortez 2017-03-06 15:19:55 -03:00 committed by GitHub
commit dd4cbf4d90

View file

@ -70,8 +70,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
return item.network == 'livenet'; return item.network == 'livenet';
}); });
} }
var walletList = [];
lodash.each(walletsToTransfer, function(v) { lodash.each(walletsToTransfer, function(v) {
originalList.push({ walletList.push({
color: v.color, color: v.color,
name: v.name, name: v.name,
recipientType: 'wallet', recipientType: 'wallet',
@ -80,16 +81,16 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
}, },
}); });
}); });
$scope.updateList(originalList); originalList = originalList.concat(walletList);
} }
} }
var updateContactsList = function() { var updateContactsList = function(cb) {
addressbookService.list(function(err, ab) { addressbookService.list(function(err, ab) {
if (err) $log.error(err); if (err) $log.error(err);
$scope.hasContacts = lodash.isEmpty(ab) ? false : true; $scope.hasContacts = lodash.isEmpty(ab) ? false : true;
if (!$scope.hasContacts) return; if (!$scope.hasContacts) return cb();
var completeContacts = []; var completeContacts = [];
lodash.each(ab, function(v, k) { lodash.each(ab, function(v, k) {
@ -106,11 +107,11 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
var contacts = completeContacts.slice(0, (currentContactsPage + 1) * CONTACTS_SHOW_LIMIT); var contacts = completeContacts.slice(0, (currentContactsPage + 1) * CONTACTS_SHOW_LIMIT);
$scope.contactsShowMore = completeContacts.length > contacts.length; $scope.contactsShowMore = completeContacts.length > contacts.length;
originalList = originalList.concat(contacts); originalList = originalList.concat(contacts);
$scope.updateList(); return cb();
}); });
}; };
$scope.updateList = function() { var updateList = function() {
$scope.list = lodash.clone(originalList); $scope.list = lodash.clone(originalList);
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
@ -199,6 +200,8 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
} }
updateHasFunds(); updateHasFunds();
updateWalletsList(); updateWalletsList();
updateContactsList(); updateContactsList(function() {
updateList();
});
}); });
}); });