From 96c1c1a29325c921e2a53052f4ff39c2a61ed145 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Mon, 16 Jan 2017 16:25:12 -0300 Subject: [PATCH 1/3] update slide text button --- src/js/controllers/confirm.js | 24 +++++++++++++++++ src/js/controllers/modals/txpDetails.js | 28 +++++++++++++++++--- www/views/confirm.html | 7 +++-- www/views/includes/slideToAccept.html | 34 ++++++++----------------- www/views/modals/txp-details.html | 7 +++-- 5 files changed, 65 insertions(+), 35 deletions(-) diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index f6264828a..1ee427e60 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -53,8 +53,30 @@ angular.module('copayApp.controllers').controller('confirmController', function( else $scope.network = (new bitcore.Address($scope.toAddress)).network.name; resetValues(); setwallets(); + applyButtonText(); }); + function applyButtonText(multisig) { + $scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' '; + + if ($scope.paypro) { + $scope.buttonText += gettextCatalog.getString('to pay'); + return; + } + + if ($scope.isGlidera || $scope.isGiftCard || $scope.cardId) { + $scope.buttonText += gettextCatalog.getString('to complete'); + return; + } + + if (multisig) { + $scope.buttonText += gettextCatalog.getString('to accept'); + return; + } + + $scope.buttonText += gettextCatalog.getString('to send'); + }; + function setwallets() { $scope.wallets = profileService.getWallets({ onlyComplete: true, @@ -268,6 +290,8 @@ angular.module('copayApp.controllers').controller('confirmController', function( $scope.getSendMaxInfo(); } else setWallet(wallet); + + applyButtonText(wallet.credentials.n > 1); }; $scope.showDescriptionPopup = function() { diff --git a/src/js/controllers/modals/txpDetails.js b/src/js/controllers/modals/txpDetails.js index 692b21a6f..ee2904a43 100644 --- a/src/js/controllers/modals/txpDetails.js +++ b/src/js/controllers/modals/txpDetails.js @@ -19,15 +19,37 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi $scope.displayUnit = getDisplayUnit($scope.tx.amountStr); initActionList(); checkPaypro(); - } + applyButtonText(); + }; + + function applyButtonText(multisig) { + $scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' '; + + if ($scope.paypro) { + $scope.buttonText += gettextCatalog.getString('to pay'); + return; + } + + if ($scope.isGlidera || $scope.isGiftCard || $scope.cardId) { + $scope.buttonText += gettextCatalog.getString('to complete'); + return; + } + + if (multisig) { + $scope.buttonText += gettextCatalog.getString('to accept'); + return; + } + + $scope.buttonText += gettextCatalog.getString('to send'); + }; function getDisplayAmount(amountStr) { return amountStr.split(' ')[0]; - } + }; function getDisplayUnit(amountStr) { return amountStr.split(' ')[1]; - } + }; function initActionList() { $scope.actionList = []; diff --git a/www/views/confirm.html b/www/views/confirm.html index 8ad43e6f2..9612e42dc 100644 --- a/www/views/confirm.html +++ b/www/views/confirm.html @@ -131,17 +131,16 @@ has-wallet-chosen="wallet" insufficient-funds="insufficientFunds" no-matching-wallet="noMatchingWallet"> - {{'Accept' | translate}} + {{buttonText}} - {{'Accept' | translate}} + {{buttonText}} -
+ ng-touchstart="onTouchstart($event)" + ng-touchmove="onTouchmove($event)" + ng-touchend="onTouchend($event)" + ng-mousedown="onTouchstart($event)" + ng-mousemove="onTouchmove($event)" + ng-mouseup="onTouchend($event)"> +
-
+
-
+
-
+
{{displaySendStatus}}
diff --git a/www/views/modals/txp-details.html b/www/views/modals/txp-details.html index f437cede2..a37cdc7b7 100644 --- a/www/views/modals/txp-details.html +++ b/www/views/modals/txp-details.html @@ -166,19 +166,18 @@ ng-if="tx.pendingForUs && canSign && !paymentExpired && hasClick" click-send-status="sendStatus" has-wallet-chosen="true"> - {{'Accept'| translate}} + {{buttonText}} - {{'Accept'| translate}} + {{buttonText}} + slide-success-on-confirm="onSuccessConfirm()"> {{'Payment Sent' | translate}} From 10315d13b8d5147354af1a59f8b2a2fa0f6ebbe9 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Mon, 16 Jan 2017 17:12:55 -0300 Subject: [PATCH 2/3] check last signer --- src/js/controllers/confirm.js | 18 +++++------------- src/js/controllers/modals/txpDetails.js | 22 +++++++--------------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 1ee427e60..7a3915b8f 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -59,22 +59,14 @@ angular.module('copayApp.controllers').controller('confirmController', function( function applyButtonText(multisig) { $scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' '; - if ($scope.paypro) { - $scope.buttonText += gettextCatalog.getString('to pay'); - return; - } - if ($scope.isGlidera || $scope.isGiftCard || $scope.cardId) { $scope.buttonText += gettextCatalog.getString('to complete'); - return; - } - - if (multisig) { + } else if ($scope.paypro) { + $scope.buttonText += gettextCatalog.getString('to pay'); + } else if (multisig) { $scope.buttonText += gettextCatalog.getString('to accept'); - return; - } - - $scope.buttonText += gettextCatalog.getString('to send'); + } else + $scope.buttonText += gettextCatalog.getString('to send'); }; function setwallets() { diff --git a/src/js/controllers/modals/txpDetails.js b/src/js/controllers/modals/txpDetails.js index ee2904a43..5c58d3447 100644 --- a/src/js/controllers/modals/txpDetails.js +++ b/src/js/controllers/modals/txpDetails.js @@ -22,25 +22,17 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi applyButtonText(); }; - function applyButtonText(multisig) { + function applyButtonText() { $scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' '; - if ($scope.paypro) { - $scope.buttonText += gettextCatalog.getString('to pay'); - return; - } + var lastSigner = lodash.filter($scope.tx.actions, { + type: 'accept' + }).length == $scope.tx.requiredSignatures - 1; - if ($scope.isGlidera || $scope.isGiftCard || $scope.cardId) { - $scope.buttonText += gettextCatalog.getString('to complete'); - return; - } - - if (multisig) { + if (lastSigner) + $scope.buttonText += gettextCatalog.getString('to send'); + else $scope.buttonText += gettextCatalog.getString('to accept'); - return; - } - - $scope.buttonText += gettextCatalog.getString('to send'); }; function getDisplayAmount(amountStr) { From 6fce4826e299fe09df2f23c41cd239079b8b32a8 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Mon, 16 Jan 2017 18:17:58 -0300 Subject: [PATCH 3/3] fix multisig parameter --- src/js/controllers/confirm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 7a3915b8f..6c6e7fff8 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -283,7 +283,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( } else setWallet(wallet); - applyButtonText(wallet.credentials.n > 1); + applyButtonText(wallet.credentials.m > 1); }; $scope.showDescriptionPopup = function() {