updates hasFunds
This commit is contained in:
parent
7d9a4244c9
commit
a661b5bc58
1 changed files with 32 additions and 1 deletions
|
|
@ -6,7 +6,6 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
var CONTACTS_SHOW_LIMIT;
|
||||
var currentContactsPage;
|
||||
|
||||
$scope.hasFunds = false;
|
||||
|
||||
var updateList = function() {
|
||||
CONTACTS_SHOW_LIMIT = 10;
|
||||
|
|
@ -105,11 +104,43 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
var updateHasFunds = function() {
|
||||
$scope.hasFunds = null;
|
||||
|
||||
var wallets = profileService.getWallets({
|
||||
onlyComplete: true,
|
||||
});
|
||||
|
||||
if (!wallets || !wallets.length) {
|
||||
$scope.hasFunds = false;
|
||||
}
|
||||
|
||||
var index = 0;
|
||||
lodash.each(wallets, function(w) {
|
||||
walletService.getStatus(w, {}, function(err, status) {
|
||||
++index;
|
||||
if (err || !status) {
|
||||
$log.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (status.availableBalanceSat) {
|
||||
$scope.hasFunds = true;
|
||||
}
|
||||
if (index == wallets.length) {
|
||||
$scope.hasFunds = $scope.hasFunds || false;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.formData = {
|
||||
search: null
|
||||
};
|
||||
updateList();
|
||||
updateHasFunds();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue