better send tab without internet

This commit is contained in:
Matias Alejo Garcia 2017-01-16 16:58:42 -03:00
commit aa05165710
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
3 changed files with 31 additions and 20 deletions

View file

@ -94,8 +94,8 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$timeout(function() {
item.getAddress(function(err, addr) {
if (err || !addr) {
$log.error(err);
return;
//Error is already formated
return popupService.showAlert(err);
}
$log.debug('Got toAddress:' + addr + ' | ' + item.name);
return $state.transitionTo('tabs.send.amount', {
@ -109,6 +109,10 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
});
};
// THIS is ONLY to show the 'buy bitcoins' message
// does not has any other function.
var updateHasFunds = function() {
if ($rootScope.everHasFunds) {
@ -128,20 +132,18 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
});
}
$scope.checkingBalanceError = false;
$scope.checkingBalance = true;
var index = 0,
errorShown = 0;
var index = 0;
lodash.each(wallets, function(w) {
walletService.getStatus(w, {}, function(err, status) {
++index;
if (err && !status) {
$log.error(err);
if (!errorShown++) popupService.showAlert(bwcError.msg(err, gettextCatalog.getString('Could not update wallet')));
$scope.checkingBalanceError = true;
return;
// error updating the wallet. Probably a network error, do not show
// the 'buy bitcoins' message.
$scope.hasFunds = true;
} else if (status.availableBalanceSat > 0) {
$scope.hasFunds = true;
$rootScope.everHasFunds = true;