fix typos - filter wallets in first process
This commit is contained in:
parent
3d4f216b41
commit
9784c95e72
2 changed files with 30 additions and 24 deletions
|
|
@ -31,7 +31,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
$scope.toEmail = data.stateParams.toEmail;
|
$scope.toEmail = data.stateParams.toEmail;
|
||||||
$scope.description = data.stateParams.description;
|
$scope.description = data.stateParams.description;
|
||||||
$scope.paypro = data.stateParams.paypro;
|
$scope.paypro = data.stateParams.paypro;
|
||||||
$scope.insuffientFunds = false;
|
$scope.insufficientFunds = false;
|
||||||
$scope.noMatchingWallet = false;
|
$scope.noMatchingWallet = false;
|
||||||
$scope.paymentExpired = {
|
$scope.paymentExpired = {
|
||||||
value: false
|
value: false
|
||||||
|
|
@ -42,9 +42,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
|
|
||||||
var config = configService.getSync().wallet;
|
var config = configService.getSync().wallet;
|
||||||
$scope.feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';
|
$scope.feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';
|
||||||
|
|
||||||
$scope.network = (new bitcore.Address($scope.toAddress)).network.name;
|
$scope.network = (new bitcore.Address($scope.toAddress)).network.name;
|
||||||
|
setwallets();
|
||||||
|
|
||||||
|
if ($scope.useSendMax) $scope.showWalletSelector();
|
||||||
|
else initConfirm();
|
||||||
|
});
|
||||||
|
|
||||||
|
function setwallets() {
|
||||||
$scope.wallets = profileService.getWallets({
|
$scope.wallets = profileService.getWallets({
|
||||||
onlyComplete: true,
|
onlyComplete: true,
|
||||||
network: $scope.network,
|
network: $scope.network,
|
||||||
|
|
@ -57,16 +62,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
$scope.wallet = $scope.wallets[0];
|
$scope.wallet = $scope.wallets[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($scope.useSendMax) $scope.showWalletSelector();
|
|
||||||
else initConfirm();
|
|
||||||
});
|
|
||||||
|
|
||||||
var initConfirm = function() {
|
|
||||||
toAmount = parseInt(toAmount);
|
|
||||||
amountStr = txFormatService.formatAmountStr(toAmount);
|
|
||||||
$scope.displayAmount = getDisplayAmount(amountStr);
|
|
||||||
$scope.displayUnit = getDisplayUnit(amountStr);
|
|
||||||
|
|
||||||
var filteredWallets = [];
|
var filteredWallets = [];
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var enoughFunds = false;
|
var enoughFunds = false;
|
||||||
|
|
@ -87,14 +82,24 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
if (++index == $scope.wallets.length) {
|
if (++index == $scope.wallets.length) {
|
||||||
if (!lodash.isEmpty(filteredWallets)) {
|
if (!lodash.isEmpty(filteredWallets)) {
|
||||||
$scope.wallets = lodash.clone(filteredWallets);
|
$scope.wallets = lodash.clone(filteredWallets);
|
||||||
setWallet($scope.wallets[0]);
|
if (!$scope.useSendMax) setWallet($scope.wallets[0]);
|
||||||
} else {
|
} else {
|
||||||
if (!enoughFunds) $scope.insuffientFunds = true;
|
if (!enoughFunds) $scope.insufficientFunds = true;
|
||||||
$log.warn('No wallet available to make the payment');
|
$log.warn('No wallet available to make the payment');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$apply();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var initConfirm = function() {
|
||||||
|
toAmount = parseInt(toAmount);
|
||||||
|
amountStr = txFormatService.formatAmountStr(toAmount);
|
||||||
|
$scope.displayAmount = getDisplayAmount(amountStr);
|
||||||
|
$scope.displayUnit = getDisplayUnit(amountStr);
|
||||||
|
|
||||||
txFormatService.formatAlternativeStr(toAmount, function(v) {
|
txFormatService.formatAlternativeStr(toAmount, function(v) {
|
||||||
$scope.alternativeAmountStr = v;
|
$scope.alternativeAmountStr = v;
|
||||||
|
|
@ -127,13 +132,13 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
}, function(err, resp) {
|
}, function(err, resp) {
|
||||||
ongoingProcess.set('retrievingInputs', false);
|
ongoingProcess.set('retrievingInputs', false);
|
||||||
if (err) {
|
if (err) {
|
||||||
$scope.insuffientFunds = true;
|
$scope.insufficientFunds = true;
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp.amount == 0) {
|
if (resp.amount == 0) {
|
||||||
$scope.insuffientFunds = true;
|
$scope.insufficientFunds = true;
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Not enough funds for fee'));
|
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Not enough funds for fee'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -207,6 +212,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.showWalletSelector = function() {
|
$scope.showWalletSelector = function() {
|
||||||
|
if ($scope.insufficientFunds || $scope.noMatchingWallet) return;
|
||||||
$scope.showWallets = true;
|
$scope.showWallets = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -387,7 +393,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.approve = function(onSendStatusChange) {
|
$scope.approve = function(onSendStatusChange) {
|
||||||
if (!toAmount) return;
|
if (!toAmount || $scope.insufficientFunds || $scope.noMatchingWallet) return;
|
||||||
|
|
||||||
if ($scope.paypro && $scope.paymentExpired.value) {
|
if ($scope.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.'));
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
|
||||||
<ion-content ng-class="{'add-bottom-for-cta': !insuffientFunds && !noMatchingWallet}">
|
<ion-content ng-class="{'add-bottom-for-cta': !insufficientFunds && !noMatchingWallet}">
|
||||||
<div class="list">
|
<div class="list">
|
||||||
<div class="item head">
|
<div class="item head">
|
||||||
<div class="sending-label">
|
<div class="sending-label">
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
<span ng-if="tx.hasMultiplesOutputs" translate>Multiple recipients</span> -->
|
<span ng-if="tx.hasMultiplesOutputs" translate>Multiple recipients</span> -->
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<a class="item item-icon-right" ng-hide="insuffientFunds || noMatchingWallet" ng-click="showWalletSelector()">
|
<a class="item item-icon-right" ng-hide="insufficientFunds || noMatchingWallet" ng-click="showWalletSelector()">
|
||||||
<span class="label" translate>From</span>
|
<span class="label" translate>From</span>
|
||||||
<div class="wallet">
|
<div class="wallet">
|
||||||
<i class="icon big-icon-svg">
|
<i class="icon big-icon-svg">
|
||||||
|
|
@ -60,14 +60,14 @@
|
||||||
</div>
|
</div>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a class="item single-line item-icon-right" ng-if="!insuffientFunds && !noMatchingWallet" ng-click="showDescriptionPopup()">
|
<a class="item single-line item-icon-right" ng-if="!insufficientFunds && !noMatchingWallet" ng-click="showDescriptionPopup()">
|
||||||
<span class="label" translate>Add Memo</span>
|
<span class="label" translate>Add Memo</span>
|
||||||
<span class="item-note m10l">
|
<span class="item-note m10l">
|
||||||
{{description}}
|
{{description}}
|
||||||
</span>
|
</span>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<div class="item single-line" ng-if="!insuffientFunds && !noMatchingWallet">
|
<div class="item single-line" ng-if="!insufficientFunds && !noMatchingWallet">
|
||||||
<span class="label" translate>Fee: {{feeLevel}}</span>
|
<span class="label" translate>Fee: {{feeLevel}}</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{fee || '...'}}
|
{{fee || '...'}}
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
<div class="text-center" ng-show="noMatchingWallet">
|
<div class="text-center" ng-show="noMatchingWallet">
|
||||||
<span class="badge badge-energized" translate>No wallets available</span>
|
<span class="badge badge-energized" translate>No wallets available</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center" ng-show="insuffientFunds">
|
<div class="text-center" ng-show="insufficientFunds">
|
||||||
<span class="badge badge-energized" translate>Insufficient funds</span>
|
<span class="badge badge-energized" translate>Insufficient funds</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -84,12 +84,12 @@
|
||||||
</ion-content>
|
</ion-content>
|
||||||
<click-to-accept
|
<click-to-accept
|
||||||
ng-click="approve(statusChangeHandler)"
|
ng-click="approve(statusChangeHandler)"
|
||||||
ng-if="!isCordova && wallets[0] && !insuffientFunds"
|
ng-if="!isCordova && wallets[0] && !insufficientFunds && !noMatchingWallet"
|
||||||
click-send-status="sendStatus">
|
click-send-status="sendStatus">
|
||||||
Click to pay
|
Click to pay
|
||||||
</click-to-accept>
|
</click-to-accept>
|
||||||
<slide-to-accept
|
<slide-to-accept
|
||||||
ng-if="isCordova && wallets[0] && !insuffientFunds"
|
ng-if="isCordova && wallets[0] && !insufficientFunds && !noMatchingWallet"
|
||||||
slide-on-confirm="onConfirm()"
|
slide-on-confirm="onConfirm()"
|
||||||
slide-send-status="sendStatus">
|
slide-send-status="sendStatus">
|
||||||
Slide to pay
|
Slide to pay
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue