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 = [];

View File

@ -131,17 +131,16 @@
has-wallet-chosen="wallet"
insufficient-funds="insufficientFunds"
no-matching-wallet="noMatchingWallet">
{{'Accept' | translate}}
{{buttonText}}
</click-to-accept>
<slide-to-accept
ng-disabled="!wallet"
ng-if="isCordova"
ng-if="isCordova && (wallet && !insufficientFunds && !noMatchingWallet)"
slide-on-confirm="onConfirm()"
slide-send-status="sendStatus"
has-wallet-chosen="wallet"
insufficient-funds="insufficientFunds"
no-matching-wallet="noMatchingWallet">
{{'Accept' | translate}}
{{buttonText}}
</slide-to-accept>
<slide-to-accept-success
slide-success-show="sendStatus === 'success'"

View File

@ -1,34 +1,20 @@
<div class="slide__listener"
ng-touchstart="onTouchstart($event);"
ng-touchmove="onTouchmove($event);"
ng-touchend="onTouchend($event);"
ng-mousedown="onTouchstart($event);"
ng-mousemove="onTouchmove($event);"
ng-mouseup="onTouchend($event);"
>
<div
class="slide__slider"
ng-style="sliderStyle"
>
ng-touchstart="onTouchstart($event)"
ng-touchmove="onTouchmove($event)"
ng-touchend="onTouchend($event)"
ng-mousedown="onTouchstart($event)"
ng-mousemove="onTouchmove($event)"
ng-mouseup="onTouchend($event)">
<div class="slide__slider" ng-style="sliderStyle">
<div class="slide__slider__tip"></div>
</div>
<div
class="slide__bitcoin"
ng-style="bitcoinStyle"
>
<div class="slide__bitcoin" ng-style="bitcoinStyle">
<img src="img/icon-bitcoin-white.svg">
</div>
<div
class="slide__button-text"
ng-style="textStyle"
>
<div class="slide__button-text" ng-style="textStyle">
<ng-transclude></ng-transclude>
</div>
<div
class="slide__status-text"
ng-class="{enter: isSlidFully}"
ng-hide="sendStatus === 'success'"
>
<div class="slide__status-text" ng-class="{enter: isSlidFully}" ng-hide="sendStatus === 'success'">
<img src="img/spinner.png">
{{displaySendStatus}}
</div>

View File

@ -166,19 +166,18 @@
ng-if="tx.pendingForUs && canSign && !paymentExpired && hasClick"
click-send-status="sendStatus"
has-wallet-chosen="true">
{{'Accept'| translate}}
{{buttonText}}
</click-to-accept>
<slide-to-accept
ng-if="tx.pendingForUs && canSign && !paymentExpired && !hasClick"
slide-on-confirm="onConfirm()"
slide-send-status="sendStatus"
has-wallet-chosen="true">
{{'Accept'| translate}}
{{buttonText}}
</slide-to-accept>
<slide-to-accept-success
slide-success-show="sendStatus === 'success'"
slide-success-on-confirm="onSuccessConfirm()"
>
slide-success-on-confirm="onSuccessConfirm()">
{{'Payment Sent' | translate}}
</slide-to-accept-success>
</ion-modal-view>