Merge pull request #3918 from cmgustavo/bug/duplicate-request-touchid-password

Fix duplicate request of password or touchid
This commit is contained in:
Matias Alejo Garcia 2016-02-25 12:12:50 -03:00
commit eaff73e989
2 changed files with 21 additions and 27 deletions

View file

@ -32,7 +32,7 @@
ng-click="confirm.accept(index.confirmTx.callback)"
class="small m10b round expand"
ng-style="{'background-color':index.backgroundColor}" translate>
Accept
Confirm
</button>
</div>
</div>

View file

@ -923,7 +923,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
return;
} else {
$rootScope.$emit('Local/NeedsConfirmation', txp, function(accept) {
if (accept) self.acceptTx(txp);
if (accept) self.confirmTx(txp);
else self.resetForm();
});
}
@ -932,7 +932,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
}, 100);
};
this.acceptTx = function(txp) {
this.confirmTx = function(txp) {
var self = this;
txService.prepare(function(err) {
if (err) {
@ -944,35 +944,29 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
self.setOngoingProcess();
self.setSendError(err);
} else {
self.prepareSignAndBroadcastTx(txpPublished);
txService.signAndBroadcast(txpPublished, {
reporterFn: self.setOngoingProcess.bind(self)
}, function(err, txp) {
self.resetForm();
if (err) {
self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen');
$scope.$emit('Local/TxProposalAction');
$timeout(function() {
$scope.$digest();
}, 1);
} else {
go.walletHome();
txStatus.notify(txp, function() {
$scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted');
});
}
});
}
});
});
};
this.prepareSignAndBroadcastTx = function(txp) {
var fc = profileService.focusedClient;
var self = this;
txService.prepareAndSignAndBroadcast(txp, {
reporterFn: self.setOngoingProcess.bind(self)
}, function(err, txp) {
self.resetForm();
if (err) {
self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen');
$scope.$emit('Local/TxProposalAction');
$timeout(function() {
$scope.$digest();
}, 1);
} else {
go.walletHome();
txStatus.notify(txp, function() {
$scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted');
});
}
});
};
this.setForm = function(to, amount, comment) {
var form = $scope.sendForm;
if (to) {