mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #4639 from cmgustavo/bug/double-tap-01
Prevent double tap (on mobile)
This commit is contained in:
commit
f22860a7a0
|
@ -27,46 +27,49 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
$scope.error = null;
|
||||
$scope.loading = 'Signing Transaction';
|
||||
|
||||
fingerprintService.check(fc, function(err) {
|
||||
if (err) {
|
||||
$scope.error = bwcError.msg(err);
|
||||
$scope.loading = null;
|
||||
return;
|
||||
}
|
||||
$timeout(function() {
|
||||
|
||||
handleEncryptedWallet(function(err) {
|
||||
fingerprintService.check(fc, function(err) {
|
||||
if (err) {
|
||||
$scope.error = bwcError.msg(err);
|
||||
$scope.loading = null;
|
||||
return;
|
||||
}
|
||||
|
||||
walletService.signTx(fc, txp, function(err, signedTxp) {
|
||||
walletService.lock(fc);
|
||||
handleEncryptedWallet(function(err) {
|
||||
if (err) {
|
||||
$scope.error = bwcError.msg(err);
|
||||
$scope.loading = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (signedTxp.status == 'accepted') {
|
||||
$scope.loading = 'Broadcasting Transaction';
|
||||
walletService.broadcastTx(fc, signedTxp, function(err, broadcastedTxp) {
|
||||
walletService.signTx(fc, txp, function(err, signedTxp) {
|
||||
walletService.lock(fc);
|
||||
if (err) {
|
||||
$scope.error = bwcError.msg(err);
|
||||
$scope.loading = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (signedTxp.status == 'accepted') {
|
||||
$scope.loading = 'Broadcasting Transaction';
|
||||
walletService.broadcastTx(fc, signedTxp, function(err, broadcastedTxp) {
|
||||
$scope.loading = null;
|
||||
$scope.$emit('UpdateTx');
|
||||
$scope.close(broadcastedTxp);
|
||||
if (err) {
|
||||
$scope.error = err;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.loading = null;
|
||||
$scope.$emit('UpdateTx');
|
||||
$scope.close(broadcastedTxp);
|
||||
if (err) {
|
||||
$scope.error = err;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.loading = null;
|
||||
$scope.$emit('UpdateTx');
|
||||
$scope.close(signedTxp);
|
||||
}
|
||||
$scope.close(signedTxp);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}, 10);
|
||||
};
|
||||
|
||||
$scope.reject = function(txp) {
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue