From 6491153fa39168f1d61cdce5f3400b37c1610a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Thu, 2 Mar 2017 16:56:44 -0300 Subject: [PATCH] fix flash when entering send tab view --- src/js/controllers/tab-send.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js index 2a1f0a9f6..96694847f 100644 --- a/src/js/controllers/tab-send.js +++ b/src/js/controllers/tab-send.js @@ -70,8 +70,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function( return item.network == 'livenet'; }); } + var walletList = []; lodash.each(walletsToTransfer, function(v) { - originalList.push({ + walletList.push({ color: v.color, name: v.name, 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) { if (err) $log.error(err); $scope.hasContacts = lodash.isEmpty(ab) ? false : true; - if (!$scope.hasContacts) return; + if (!$scope.hasContacts) return cb(); var completeContacts = []; 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); $scope.contactsShowMore = completeContacts.length > contacts.length; originalList = originalList.concat(contacts); - $scope.updateList(); + return cb(); }); }; - $scope.updateList = function() { + var updateList = function() { $scope.list = lodash.clone(originalList); $timeout(function() { $ionicScrollDelegate.resize(); @@ -199,6 +200,8 @@ angular.module('copayApp.controllers').controller('tabSendController', function( } updateHasFunds(); updateWalletsList(); - updateContactsList(); + updateContactsList(function() { + updateList(); + }); }); });