add "Cache" for hasFunds

This commit is contained in:
Matias Alejo Garcia 2016-10-15 09:41:35 -03:00
parent f9fd629734
commit 0fbde71996
No known key found for this signature in database
GPG Key ID: 02470DB551277AB3
1 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService) {
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService, $rootScope) {
var originalList;
var CONTACTS_SHOW_LIMIT;
@ -113,6 +113,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
var updateHasFunds = function() {
$scope.hasFunds = true;
if ($rootScope.everHasFunds)
return;
var wallets = profileService.getWallets({
onlyComplete: true,
});
@ -134,6 +137,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
return;
}
walletsTotalBalance = walletsTotalBalance + status.availableBalanceSat;
if (walletsTotalBalance>0) {
$rootScope.everHasFunds = true;
}
if (index == wallets.length && walletsTotalBalance == 0) {
$scope.hasFunds = false;
$timeout(function() {