fix displaying errors

This commit is contained in:
Javier 2016-08-04 17:12:41 -03:00
commit d6c25896f7

View file

@ -25,29 +25,36 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.sign = function(txp) { $scope.sign = function(txp) {
$scope.error = null; $scope.error = null;
var prefix = fc.credentials.m > 1 ? gettextCatalog.getString('Could not create payment proposal') : gettextCatalog.getString('Could not send payment');
$scope.loading = 'Signing Transaction'; $scope.loading = 'Signing Transaction';
$timeout(function() {
fingerprintService.check(fc, function(err) { fingerprintService.check(fc, function(err) {
if (err) { if (err) {
$scope.error = bwcError.msg(err);
$scope.loading = null; $scope.loading = null;
$scope.error = prefix;
$timeout(function() {
$scope.$digest();
}, 1);
return; return;
} }
handleEncryptedWallet(function(err) { handleEncryptedWallet(function(err) {
if (err) { if (err) {
$scope.error = bwcError.msg(err);
$scope.loading = null; $scope.loading = null;
$scope.error = bwcError.msg(err, prefix);
$timeout(function() {
$scope.$digest();
}, 1);
return; return;
} }
walletService.signTx(fc, txp, function(err, signedTxp) { walletService.signTx(fc, txp, function(err, signedTxp) {
walletService.lock(fc);
if (err) { if (err) {
$scope.error = bwcError.msg(err);
$scope.loading = null; $scope.loading = null;
$scope.error = bwcError.msg(err, prefix);
$timeout(function() {
$scope.$digest();
}, 1);
return; return;
} }
@ -59,6 +66,9 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.close(broadcastedTxp); $scope.close(broadcastedTxp);
if (err) { if (err) {
$scope.error = err; $scope.error = err;
$timeout(function() {
$scope.$digest();
}, 1);
} }
}); });
} else { } else {
@ -69,9 +79,12 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
}); });
}); });
}); });
}, 10);
}; };
$scope.$on('$destroy', function() {
walletService.lock(fc);
});
$scope.reject = function(txp) { $scope.reject = function(txp) {
$scope.loading = 'Rejecting payment'; $scope.loading = 'Rejecting payment';
$scope.error = null; $scope.error = null;