Prevent double tap (in mobile)

This commit is contained in:
Gustavo Maximiliano Cortez 2016-08-01 14:16:47 -03:00
commit b210a970d3
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
2 changed files with 82 additions and 76 deletions

View file

@ -823,70 +823,73 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
this.error = null;
ongoingProcess.set('calculatingFee', true);
feeService.getCurrentFeeValue(function(err, feePerKb) {
ongoingProcess.set('calculatingFee', false);
if (err || !lodash.isNumber(feePerKb)) {
self.error = gettext('Could not get fee value');
return;
}
$timeout(function() {
var opts = {};
opts.feePerKb = feePerKb;
opts.returnInputs = true;
var config = configService.getSync();
opts.excludeUnconfirmedUtxos = !config.wallet.spendUnconfirmed;
ongoingProcess.set('retrivingInputs', true);
fc.getSendMaxInfo(opts, function(err, resp) {
ongoingProcess.set('retrivingInputs', false);
if (err) {
self.error = err;
$scope.$apply();
feeService.getCurrentFeeValue(function(err, feePerKb) {
ongoingProcess.set('calculatingFee', false);
if (err || !lodash.isNumber(feePerKb)) {
self.error = gettext('Could not get fee value');
return;
}
if (resp.amount == 0) {
self.error = gettext("Not enough funds for fee");
$scope.$apply();
return;
}
var opts = {};
opts.feePerKb = feePerKb;
opts.returnInputs = true;
var config = configService.getSync();
opts.excludeUnconfirmedUtxos = !config.wallet.spendUnconfirmed;
ongoingProcess.set('retrivingInputs', true);
var msg = gettextCatalog.getString("{{fee}} will be deducted for bitcoin networking fees", {
fee: profileService.formatAmount(resp.fee) + ' ' + self.unitName
});
fc.getSendMaxInfo(opts, function(err, resp) {
ongoingProcess.set('retrivingInputs', false);
var warningMsg = verifyExcludedUtxos();
if (err) {
self.error = err;
$scope.$apply();
return;
}
if (!lodash.isEmpty(warningMsg))
msg += '. \n' + warningMsg;
if (resp.amount == 0) {
self.error = gettext("Not enough funds for fee");
$scope.$apply();
return;
}
confirmDialog.show(msg, function(confirmed) {
if (confirmed) {
self.sendMaxInfo = resp;
var amount = parseFloat((resp.amount * self.satToUnit).toFixed(self.unitDecimals));
self.setForm(null, amount, null);
} else {
self.resetForm();
var msg = gettextCatalog.getString("{{fee}} will be deducted for bitcoin networking fees", {
fee: profileService.formatAmount(resp.fee) + ' ' + self.unitName
});
var warningMsg = verifyExcludedUtxos();
if (!lodash.isEmpty(warningMsg))
msg += '. \n' + warningMsg;
confirmDialog.show(msg, function(confirmed) {
if (confirmed) {
self.sendMaxInfo = resp;
var amount = parseFloat((resp.amount * self.satToUnit).toFixed(self.unitDecimals));
self.setForm(null, amount, null);
} else {
self.resetForm();
}
});
function verifyExcludedUtxos() {
var warningMsg = [];
if (resp.utxosBelowFee > 0) {
warningMsg.push(gettextCatalog.getString("Note: a total of {{amountBelowFeeStr}} were excluded. These funds come from UTXOs smaller than the network fee provided.", {
amountBelowFeeStr: profileService.formatAmount(resp.amountBelowFee) + ' ' + self.unitName
}));
}
if (resp.utxosAboveMaxSize > 0) {
warningMsg.push(gettextCatalog.getString("Note: a total of {{amountAboveMaxSizeStr}} were excluded. The maximum size allowed for a transaction was exceeded", {
amountAboveMaxSizeStr: profileService.formatAmount(resp.amountAboveMaxSize) + ' ' + self.unitName
}));
}
return warningMsg.join('\n');
}
});
function verifyExcludedUtxos() {
var warningMsg = [];
if (resp.utxosBelowFee > 0) {
warningMsg.push(gettextCatalog.getString("Note: a total of {{amountBelowFeeStr}} were excluded. These funds come from UTXOs smaller than the network fee provided.", {
amountBelowFeeStr: profileService.formatAmount(resp.amountBelowFee) + ' ' + self.unitName
}));
}
if (resp.utxosAboveMaxSize > 0) {
warningMsg.push(gettextCatalog.getString("Note: a total of {{amountAboveMaxSizeStr}} were excluded. The maximum size allowed for a transaction was exceeded", {
amountAboveMaxSizeStr: profileService.formatAmount(resp.amountAboveMaxSize) + ' ' + self.unitName
}));
}
return warningMsg.join('\n');
}
});
});
}, 10);
};
/* Start setup */