Merge pull request #5437 from JDonadio/ref/confirm-button

Slide/Click button at confirm view
This commit is contained in:
Gustavo Maximiliano Cortez 2017-01-16 18:35:09 -03:00 committed by GitHub
commit eea32d3069
5 changed files with 49 additions and 35 deletions

View file

@ -53,8 +53,22 @@ 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.isGlidera || $scope.isGiftCard || $scope.cardId) {
$scope.buttonText += gettextCatalog.getString('to complete');
} else if ($scope.paypro) {
$scope.buttonText += gettextCatalog.getString('to pay');
} else if (multisig) {
$scope.buttonText += gettextCatalog.getString('to accept');
} else
$scope.buttonText += gettextCatalog.getString('to send');
};
function setwallets() {
$scope.wallets = profileService.getWallets({
onlyComplete: true,
@ -285,6 +299,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.getSendMaxInfo();
} else
setWallet(wallet);
applyButtonText(wallet.credentials.m > 1);
};
$scope.showDescriptionPopup = function() {

View file

@ -19,15 +19,29 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.displayUnit = getDisplayUnit($scope.tx.amountStr);
initActionList();
checkPaypro();
}
applyButtonText();
};
function applyButtonText() {
$scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' ';
var lastSigner = lodash.filter($scope.tx.actions, {
type: 'accept'
}).length == $scope.tx.requiredSignatures - 1;
if (lastSigner)
$scope.buttonText += gettextCatalog.getString('to send');
else
$scope.buttonText += gettextCatalog.getString('to accept');
};
function getDisplayAmount(amountStr) {
return amountStr.split(' ')[0];
}
};
function getDisplayUnit(amountStr) {
return amountStr.split(' ')[1];
}
};
function initActionList() {
$scope.actionList = [];