Error getting fee

This commit is contained in:
Gustavo Maximiliano Cortez 2015-12-24 11:08:49 -03:00
commit 4af0f15380
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
2 changed files with 15 additions and 3 deletions

View file

@ -387,7 +387,7 @@
<h4 class="title m0"> <h4 class="title m0">
<available-balance></available-balance> <available-balance></available-balance>
<a <a
ng-if="index.feeToSendMaxStr && index.availableBalanceSat > 0 && !home.blockUx && !home.lockAmount" ng-show="!home.lockedCurrentFeePerKb && index.feeToSendMaxStr && index.availableBalanceSat > 0 && !home.blockUx && !home.lockAmount"
ng-click="home.sendAll()" ng-click="home.sendAll()"
translate> Send All translate> Send All
</a> </a>

View file

@ -831,6 +831,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
var unitToSat = this.unitToSatoshi; var unitToSat = this.unitToSatoshi;
var currentSpendUnconfirmed = configWallet.spendUnconfirmed; var currentSpendUnconfirmed = configWallet.spendUnconfirmed;
var currentFeeLevel = walletSettings.feeLevel || 'normal';
if (isCordova && this.isWindowsPhoneApp) { if (isCordova && this.isWindowsPhoneApp) {
this.hideAddress = false; this.hideAddress = false;
@ -864,7 +865,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
if (self.lockedCurrentFeePerKb) { if (self.lockedCurrentFeePerKb) {
cb(null, self.lockedCurrentFeePerKb); cb(null, self.lockedCurrentFeePerKb);
} else { } else {
feeService.getCurrentFeeValue(self.currentFeeLevel, cb); feeService.getCurrentFeeValue(currentFeeLevel, cb);
} }
}; };
@ -1272,15 +1273,26 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
this.sendAll = function() { this.sendAll = function() {
var self = this; var self = this;
self.error = null;
self.setOngoingProcess(gettext('Getting fee'));
$rootScope.$emit('Local/SetFeeSendMax', function(currentFeePerKb, availableMaxBalance, feeToSendMaxStr) { $rootScope.$emit('Local/SetFeeSendMax', function(currentFeePerKb, availableMaxBalance, feeToSendMaxStr) {
self.setOngoingProcess();
if (lodash.isNull(currentFeePerKb)) {
self.error = gettext('Could not calculate fee');
$scope.$apply();
return;
}
self.lockedCurrentFeePerKb = currentFeePerKb; self.lockedCurrentFeePerKb = currentFeePerKb;
var msg = gettextCatalog.getString("{{fee}} will be deducted for bitcoin networking fees", { var msg = gettextCatalog.getString("{{fee}} will be deducted for bitcoin networking fees", {
fee: feeToSendMaxStr fee: feeToSendMaxStr
}); });
$scope.$apply();
confirmDialog.show(msg, function(confirmed) { confirmDialog.show(msg, function(confirmed) {
if (confirmed) { if (confirmed) {
self._doSendAll(availableMaxBalance); self._doSendAll(availableMaxBalance);
} else {
self.resetForm();
} }
}); });
}); });