walletStatus worst case, IIFE for both controllers.

This commit is contained in:
Jean-Baptiste Dominguez 2018-09-21 11:31:27 +02:00
commit 4250a98718
2 changed files with 969 additions and 961 deletions

View file

@ -1,5 +1,7 @@
'use strict'; 'use strict';
(function () {
angular angular
.module('copayApp.controllers') .module('copayApp.controllers')
.controller('reviewController', reviewController); .controller('reviewController', reviewController);
@ -948,5 +950,5 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
}); });
}); });
} }
} }
})();

View file

@ -1,7 +1,12 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('walletSelectorController', function($scope, $state, sendFlowService, configService, gettextCatalog, ongoingProcess, profileService, walletService, txFormatService) { (function () {
angular
.module('copayApp.controllers')
.controller('walletSelectorController', walletSelectorController);
function walletSelectorController ($scope, $state, sendFlowService, configService, gettextCatalog, ongoingProcess, profileService, walletService, txFormatService) {
var fromWalletId = ''; var fromWalletId = '';
var priceDisplayAsFiat = false; var priceDisplayAsFiat = false;
var unitDecimals = 0; var unitDecimals = 0;
@ -144,7 +149,7 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
walletStatus = wallet.cachedStatus; walletStatus = wallet.cachedStatus;
} }
if (walletStatus.availableBalanceSat > ($scope.params.amount ? $scope.params.amount : 0)) { if (walletStatus && walletStatus.availableBalanceSat > ($scope.params.amount ? $scope.params.amount : 0)) {
walletsSufficientFunds.push(wallet); walletsSufficientFunds.push(wallet);
} else { } else {
$scope.walletsInsufficientFunds.push(wallet); $scope.walletsInsufficientFunds.push(wallet);
@ -195,4 +200,5 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
sendFlowService.router.goBack(); sendFlowService.router.goBack();
} }
}); }
})();