allow user to cancel a transaction when using the slide to pay component

This commit is contained in:
Marty Alcala 2016-10-10 14:33:55 -04:00
commit 34566e13a7
3 changed files with 20 additions and 12 deletions

View file

@ -297,13 +297,19 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (!spendingPassEnabled && !touchIdEnabled) { if (!spendingPassEnabled && !touchIdEnabled) {
if (isCordova && bigAmount) { if (isCordova && bigAmount) {
popupService.showConfirm(null, message, okText, cancelText, function(ok) { popupService.showConfirm(null, message, okText, cancelText, function(ok) {
if (!ok) return; if (!ok) {
$scope.sendStatus = '';
return;
}
publishAndSign(wallet, txp, onSendStatusChange); publishAndSign(wallet, txp, onSendStatusChange);
}); });
} }
else { else {
popupService.showConfirm(null, message, okText, cancelText, function(ok) { popupService.showConfirm(null, message, okText, cancelText, function(ok) {
if (!ok) return; if (!ok) {
$scope.sendStatus = '';
return;
}
publishAndSign(wallet, txp, onSendStatusChange); publishAndSign(wallet, txp, onSendStatusChange);
}); });
} }

View file

@ -33,9 +33,13 @@ angular.module('copayApp.directives')
scope.displaySendStatus = ''; scope.displaySendStatus = '';
scope.$watch('sendStatus', function() { scope.$watch('sendStatus', function() {
if(scope.sendStatus === 'success') { if(!scope.sendStatus) {
scope.displaySendStatus = '';
reset(); reset();
} else if(scope.sendStatus === 'success') {
scope.displaySendStatus = '';
$timeout(function() {
reset();
}, 500);
} else { } else {
scope.displaySendStatus = scope.sendStatus; scope.displaySendStatus = scope.sendStatus;
} }
@ -79,13 +83,11 @@ angular.module('copayApp.directives')
} }
function reset() { function reset() {
$timeout(function() { scope.isSlidFully = false;
scope.isSlidFully = false; isSliding = false;
isSliding = false; setNewSliderStyle(getKnobWidthPercentage());
setNewSliderStyle(getKnobWidthPercentage()); setNewBitcoinStyle(0);
setNewBitcoinStyle(0); setNewTextStyle(0);
setNewTextStyle(0);
}, 500);
} }
function setNewSliderStyle(pct) { function setNewSliderStyle(pct) {

View file

@ -93,9 +93,9 @@ slide-to-accept {
text-transform: capitalize; text-transform: capitalize;
transform: translateY(2rem); transform: translateY(2rem);
opacity: 0; opacity: 0;
transition: transform 250ms ease, opacity 250ms ease;
&.enter { &.enter {
transition: transform 250ms ease, opacity 250ms ease;
transform: translateY(0); transform: translateY(0);
opacity: 1; opacity: 1;
} }