From 72ac721642e2c07a106c44f759c80455887aa3a2 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 25 Feb 2016 10:41:04 -0300 Subject: [PATCH 1/2] Fix duplicate request of password or touchid --- src/js/controllers/walletHome.js | 42 ++++++++++++++------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 1831335bb..028cd629e 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -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) { From 6037d9bf40332b617b47cc44faa030a3af202a63 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 25 Feb 2016 12:07:47 -0300 Subject: [PATCH 2/2] Renames confirm --- public/views/includes/confirm-tx.html | 2 +- src/js/controllers/walletHome.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/views/includes/confirm-tx.html b/public/views/includes/confirm-tx.html index 3cadb0ca0..9e3425b14 100644 --- a/public/views/includes/confirm-tx.html +++ b/public/views/includes/confirm-tx.html @@ -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 diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 028cd629e..606702a97 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -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) {