mirror of https://github.com/BTCPrivate/copay.git
fix paypro
This commit is contained in:
parent
54b554d279
commit
13b8b81e11
|
@ -22,8 +22,16 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
|
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$apply();
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$scope.showWalletSelector = function() {
|
$scope.showWalletSelector = function() {
|
||||||
$scope.walletSelector = true;
|
$scope.walletSelector = true;
|
||||||
|
refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeLeave", function(event, data) {
|
$scope.$on("$ionicView.beforeLeave", function(event, data) {
|
||||||
|
@ -133,12 +141,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
// Other Scope vars
|
// Other Scope vars
|
||||||
$scope.isCordova = isCordova;
|
$scope.isCordova = isCordova;
|
||||||
$scope.showAddress = false;
|
$scope.showAddress = false;
|
||||||
$scope.paymentExpired = {
|
|
||||||
value: false
|
updateTx(tx, null, {}, function() {
|
||||||
};
|
|
||||||
$scope.remainingTimeStr = {
|
|
||||||
value: null
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.walletSelectorTitle = gettextCatalog.getString('Send from');
|
$scope.walletSelectorTitle = gettextCatalog.getString('Send from');
|
||||||
|
|
||||||
|
@ -153,6 +157,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
setWallet($scope.wallets[0], tx);
|
setWallet($scope.wallets[0], tx);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,12 +232,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
|
|
||||||
$scope.tx = tx;
|
$scope.tx = tx;
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.$apply();
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateAmount() {
|
function updateAmount() {
|
||||||
if (!tx.toAmount) return;
|
if (!tx.toAmount) return;
|
||||||
|
|
||||||
|
@ -253,6 +253,10 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
tx.feeRate = feeRate;
|
tx.feeRate = feeRate;
|
||||||
tx.feeLevelName = feeService.feeOpts[tx.feeLevel];
|
tx.feeLevelName = feeService.feeOpts[tx.feeLevel];
|
||||||
|
|
||||||
|
// End of quick refresh, before wallet is selected.
|
||||||
|
if (!wallet)
|
||||||
|
return cb();
|
||||||
|
|
||||||
getSendMaxInfo(lodash.clone(tx), wallet, function(err, sendMaxInfo) {
|
getSendMaxInfo(lodash.clone(tx), wallet, function(err, sendMaxInfo) {
|
||||||
if (err) {
|
if (err) {
|
||||||
var msg = gettextCatalog.getString('Error getting SendMax information');
|
var msg = gettextCatalog.getString('Error getting SendMax information');
|
||||||
|
@ -270,7 +274,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
}
|
}
|
||||||
|
|
||||||
tx.sendMaxInfo = sendMaxInfo;
|
tx.sendMaxInfo = sendMaxInfo;
|
||||||
tx.toAmount =tx.sendMaxInfo.amount;
|
tx.toAmount = tx.sendMaxInfo.amount;
|
||||||
updateAmount();
|
updateAmount();
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
|
@ -397,7 +401,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
};
|
};
|
||||||
|
|
||||||
function _paymentTimeControl(expirationTime) {
|
function _paymentTimeControl(expirationTime) {
|
||||||
$scope.paymentExpired.value = false;
|
$scope.paymentExpired = false;
|
||||||
setExpirationTime();
|
setExpirationTime();
|
||||||
|
|
||||||
countDown = $interval(function() {
|
countDown = $interval(function() {
|
||||||
|
@ -415,12 +419,12 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
var totalSecs = expirationTime - now;
|
var totalSecs = expirationTime - now;
|
||||||
var m = Math.floor(totalSecs / 60);
|
var m = Math.floor(totalSecs / 60);
|
||||||
var s = totalSecs % 60;
|
var s = totalSecs % 60;
|
||||||
$scope.remainingTimeStr.value = ('0' + m).slice(-2) + ":" + ('0' + s).slice(-2);
|
$scope.remainingTimeStr = ('0' + m).slice(-2) + ":" + ('0' + s).slice(-2);
|
||||||
};
|
};
|
||||||
|
|
||||||
function setExpiredValues() {
|
function setExpiredValues() {
|
||||||
$scope.paymentExpired.value = true;
|
$scope.paymentExpired = true;
|
||||||
$scope.remainingTimeStr.value = gettextCatalog.getString('Expired');
|
$scope.remainingTimeStr = gettextCatalog.getString('Expired');
|
||||||
if (countDown) $interval.cancel(countDown);
|
if (countDown) $interval.cancel(countDown);
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
@ -436,9 +440,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
|
|
||||||
setButtonText(wallet.credentials.m > 1, !!tx.paypro);
|
setButtonText(wallet.credentials.m > 1, !!tx.paypro);
|
||||||
|
|
||||||
//T TODO
|
if (tx.paypro)
|
||||||
if ($scope.paypro)
|
_paymentTimeControl(tx.paypro.expires);
|
||||||
_paymentTimeControl($scope.paypro.expires);
|
|
||||||
|
|
||||||
updateTx(tx, wallet, {
|
updateTx(tx, wallet, {
|
||||||
dryRun: true
|
dryRun: true
|
||||||
|
@ -477,8 +480,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
|
|
||||||
if (!tx || !wallet) return;
|
if (!tx || !wallet) return;
|
||||||
|
|
||||||
// TODO
|
if ($scope.paymentExpired) {
|
||||||
if (tx.paypro && $scope.paymentExpired.value) {
|
|
||||||
popupService.showAlert(null, gettextCatalog.getString('This bitcoin payment request has expired.'));
|
popupService.showAlert(null, gettextCatalog.getString('This bitcoin payment request has expired.'));
|
||||||
$scope.sendStatus = '';
|
$scope.sendStatus = '';
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<div class="item single-line" ng-if="tx.paypro">
|
<div class="item single-line" ng-if="tx.paypro">
|
||||||
<span class="label" translate>Payment Expires:</span>
|
<span class="label" translate>Payment Expires:</span>
|
||||||
<span class="item-note" ng-if="!paymentExpired.value">{{remainingTimeStr.value}}</span>
|
<span class="item-note" ng-if="!paymentExpired">{{remainingTimeStr}}</span>
|
||||||
<span class="item-note" ng-if="paymentExpired.value" ng-style="{'color': 'red'}" translate>Expired</span>
|
<span class="item-note" ng-if="paymentExpired" ng-style="{'color': 'red'}" translate>Expired</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item">
|
<div class="item">
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
<span ng-if="tx.toName && showAddress">{{tx.toAddress}}</span>
|
<span ng-if="tx.toName && showAddress">{{tx.toAddress}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a class="item item-icon-right" ng-hide="!tx.sendMax ||!wallet" ng-click="showWalletSelector()">
|
<a class="item item-icon-right" ng-hide="!wallets" ng-click="showWalletSelector()">
|
||||||
<span class="label" translate>From</span>
|
<span class="label" translate>From</span>
|
||||||
<div class="wallet" ng-if="wallet">
|
<div class="wallet" ng-if="wallet">
|
||||||
<i class="icon big-icon-svg">
|
<i class="icon big-icon-svg">
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
</span>
|
</span>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<div class="text-center" ng-show="!wallet">
|
<div class="text-center" ng-show="noWalletMessage">
|
||||||
<span class="badge badge-energized">{{noWalletMessage}}</span>
|
<span class="badge badge-energized">{{noWalletMessage}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue