From 0fbde7199627ee1877f3827aa071773d28ecade9 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Sat, 15 Oct 2016 09:41:35 -0300 Subject: [PATCH] add "Cache" for hasFunds --- src/js/controllers/tab-send.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js index 4409eb698..926e017b8 100644 --- a/src/js/controllers/tab-send.js +++ b/src/js/controllers/tab-send.js @@ -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() {