Ref confirm. Removes unused code. Fix noLowFee directive

This commit is contained in:
Gustavo Maximiliano Cortez 2017-06-22 11:49:20 -03:00
parent 13b8b81e11
commit 748e8a4fbb
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
11 changed files with 50 additions and 118 deletions

View File

@ -176,12 +176,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
function getTxp(tx, wallet, dryRun, cb) { function getTxp(tx, wallet, dryRun, cb) {
var paypro = tx.paypro;
var toAddress = tx.toAddress;
var description = tx.description;
// ToDo: use a credential's (or fc's) function for this // ToDo: use a credential's (or fc's) function for this
if (description && !wallet.credentials.sharedEncryptingKey) { if (tx.description && !wallet.credentials.sharedEncryptingKey) {
var msg = gettextCatalog.getString('Could not add message to imported wallet without shared encrypting key'); var msg = gettextCatalog.getString('Could not add message to imported wallet without shared encrypting key');
$log.warn(msg); $log.warn(msg);
return setSendError(msg); return setSendError(msg);
@ -208,7 +204,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
txp.feeLevel = tx.feeLevel; txp.feeLevel = tx.feeLevel;
} }
txp.message = description; txp.message = tx.description;
if (tx.paypro) { if (tx.paypro) {
txp.payProUrl = tx.paypro.url; txp.payProUrl = tx.paypro.url;
@ -254,7 +250,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
tx.feeLevelName = feeService.feeOpts[tx.feeLevel]; tx.feeLevelName = feeService.feeOpts[tx.feeLevel];
// End of quick refresh, before wallet is selected. // End of quick refresh, before wallet is selected.
if (!wallet) if (!wallet)
return cb(); return cb();
getSendMaxInfo(lodash.clone(tx), wallet, function(err, sendMaxInfo) { getSendMaxInfo(lodash.clone(tx), wallet, function(err, sendMaxInfo) {
@ -276,6 +272,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();
showSendMaxWarning(sendMaxInfo);
} }
refresh(); refresh();
@ -286,9 +283,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
getTxp(lodash.clone(tx), wallet, opts.dryRun, function(err, txp) { getTxp(lodash.clone(tx), wallet, opts.dryRun, function(err, txp) {
if (err) return cb(err); if (err) return cb(err);
if (tx.sendMaxInfo)
showSendMaxWarning(sendMaxInfo, function(err) {});
txp.feeStr = txFormatService.formatAmountStr(txp.fee); txp.feeStr = txFormatService.formatAmountStr(txp.fee);
txFormatService.formatAlternativeStr(txp.fee, function(v) { txFormatService.formatAlternativeStr(txp.fee, function(v) {
txp.alternativeFeeStr = v; txp.alternativeFeeStr = v;
@ -360,24 +354,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
popupService.showAlert(null, msg, function() {}); popupService.showAlert(null, msg, function() {});
}; };
function setSendMaxValues(data) {
$scope.amountStr = txFormatService.formatAmountStr(data.amount, true);
$scope.displayAmount = getDisplayAmount($scope.amountStr);
$scope.displayUnit = getDisplayUnit($scope.amountStr);
$scope.fee = txFormatService.formatAmountStr(data.fee);
txFormatService.formatAlternativeStr(data.fee, function(v) {
$scope.feeFiat = v;
});
toAmount = parseFloat((data.amount * satToUnit).toFixed(unitDecimals));
txFormatService.formatAlternativeStr(data.amount, function(v) {
$scope.alternativeAmountStr = v;
});
$scope.feeRateStr = (data.fee / (data.amount + data.fee) * 100).toFixed(2) + '%';
$timeout(function() {
$scope.$apply();
});
};
$scope.$on('accepted', function(event) { $scope.$on('accepted', function(event) {
$scope.approve(); $scope.approve();
}); });
@ -565,27 +541,19 @@ angular.module('copayApp.controllers').controller('confirmController', function(
}; };
$scope.onSuccessConfirm = function() { $scope.onSuccessConfirm = function() {
var previousView = $ionicHistory.viewHistory().backView && $ionicHistory.viewHistory().backView.stateName;
$ionicHistory.nextViewOptions({
disableAnimate: true
});
$ionicHistory.removeBackView();
$scope.sendStatus = ''; $scope.sendStatus = '';
$ionicHistory.nextViewOptions({ $ionicHistory.nextViewOptions({
disableAnimate: true, disableAnimate: true,
historyRoot: true historyRoot: true
}); });
$ionicHistory.clearHistory();
$state.go('tabs.send').then(function() { $state.go('tabs.send').then(function() {
$ionicHistory.clearHistory();
$state.transitionTo('tabs.home'); $state.transitionTo('tabs.home');
}); });
}; };
$scope.chooseFeeLevel = function(tx, wallet) { $scope.chooseFeeLevel = function(tx, wallet) {
var scope = $rootScope.$new(true); var scope = $rootScope.$new(true);
scope.network = tx.network; scope.network = tx.network;
scope.feeLevel = tx.feeLevel; scope.feeLevel = tx.feeLevel;

View File

@ -12,7 +12,7 @@ angular.module('copayApp.directives')
elem.bind('click', function() { elem.bind('click', function() {
configService.whenAvailable(function(config) { configService.whenAvailable(function(config) {
if (config.wallet.settings.feeLevel.match(/conomy/)) { if (config.wallet.settings.feeLevel && config.wallet.settings.feeLevel.match(/conomy/)) {
$log.debug('Economy Fee setting... disabling link:' + elem.text()); $log.debug('Economy Fee setting... disabling link:' + elem.text());
popupService.showAlert('Low Fee Error', 'Please change your Bitcoin Network Fee Policy setting to Normal or higher to use this service', function() { popupService.showAlert('Low Fee Error', 'Please change your Bitcoin Network Fee Policy setting to Normal or higher to use this service', function() {
$ionicHistory.goBack(); $ionicHistory.goBack();

View File

@ -9,7 +9,7 @@ angular.module('copayApp.directives')
scope: { scope: {
sendStatus: '=slideSendStatus', sendStatus: '=slideSendStatus',
onConfirm: '&slideOnConfirm', onConfirm: '&slideOnConfirm',
wallet: '=hasWalletChosen' isDisabled: '=isDisabled'
}, },
link: function(scope, element, attrs) { link: function(scope, element, attrs) {

View File

@ -53,23 +53,17 @@
</ion-content> </ion-content>
<click-to-accept <click-to-accept
ng-disabled="!wallet"
ng-click="buyConfirm()" ng-click="buyConfirm()"
ng-if="!isCordova" ng-if="!isCordova"
click-send-status="sendStatus" click-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!wallet">
insufficient-funds="false"
no-matching-wallet="false">
Confirm purchase Confirm purchase
</click-to-accept> </click-to-accept>
<slide-to-accept <slide-to-accept
ng-disabled="!wallet"
ng-if="isCordova" ng-if="isCordova"
slide-on-confirm="buyConfirm()" slide-on-confirm="buyConfirm()"
slide-send-status="sendStatus" slide-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!wallet">
insufficient-funds="false"
no-matching-wallet="false">
Slide to buy Slide to buy
</slide-to-accept> </slide-to-accept>
<slide-to-accept-success <slide-to-accept-success

View File

@ -17,7 +17,7 @@
<div class="amount-label"> <div class="amount-label">
<div class="amount">{{amountUnitStr}}</div> <div class="amount">{{amountUnitStr}}</div>
<div class="alternative" ng-if="buyPrice"> <div class="alternative" ng-if="buyPrice">
<span ng-show="isFiat">{{buyRequestInfo.amount.amount}} {{buyRequestInfo.amount.currency}}</span> <span ng-show="isFiat">{{buyRequestInfo.amount.amount}} {{buyRequestInfo.amount.currency}}</span>
@ ${{buyPrice.amount}} per BTC @ ${{buyPrice.amount}} per BTC
</div> </div>
</div> </div>
@ -59,7 +59,7 @@
{{fee.type}} fee {{fee.type}} fee
</span> </span>
<span class="item-note"> <span class="item-note">
{{fee.amount.amount}} {{fee.amount.currency}} {{fee.amount.amount}} {{fee.amount.currency}}
</span> </span>
</div> </div>
<div class="item"> <div class="item">
@ -74,23 +74,17 @@
</ion-content> </ion-content>
<click-to-accept <click-to-accept
ng-disabled="!selectedPaymentMethodId.value || !buyRequestInfo || !wallet"
ng-click="buyConfirm()" ng-click="buyConfirm()"
ng-if="!isCordova && buyRequestInfo" ng-if="!isCordova && buyRequestInfo"
click-send-status="sendStatus" click-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!selectedPaymentMethodId.value || !buyRequestInfo || !wallet">
insufficient-funds="!selectedPaymentMethodId.value"
no-matching-wallet="!buyRequestInfo">
Confirm purchase Confirm purchase
</click-to-accept> </click-to-accept>
<slide-to-accept <slide-to-accept
ng-disabled="!selectedPaymentMethodId.value || !buyRequestInfo || !wallet"
ng-if="isCordova && buyRequestInfo" ng-if="isCordova && buyRequestInfo"
slide-on-confirm="buyConfirm()" slide-on-confirm="buyConfirm()"
slide-send-status="sendStatus" slide-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!selectedPaymentMethodId.value || !buyRequestInfo || !wallet">
insufficient-funds="!selectedPaymentMethodId.value"
no-matching-wallet="!buyRequestInfo">
Slide to buy Slide to buy
</slide-to-accept> </slide-to-accept>
<slide-to-accept-success <slide-to-accept-success

View File

@ -17,8 +17,8 @@
<div class="amount-label"> <div class="amount-label">
<div class="amount">{{amountUnitStr}}</div> <div class="amount">{{amountUnitStr}}</div>
<div class="alternative"> <div class="alternative">
<span ng-show="!isFiat">{{buyInfo.subtotal}} {{buyInfo.currency}}</span> <span ng-show="!isFiat">{{buyInfo.subtotal}} {{buyInfo.currency}}</span>
<span ng-show="isFiat">{{buyInfo.qty}} BTC</span> <span ng-show="isFiat">{{buyInfo.qty}} BTC</span>
@ ${{buyInfo.price}} per BTC @ ${{buyInfo.price}} per BTC
</div> </div>
</div> </div>
@ -64,23 +64,17 @@
</ion-content> </ion-content>
<click-to-accept <click-to-accept
ng-disabled="!buyInfo || !wallet"
ng-click="buyConfirm()" ng-click="buyConfirm()"
ng-if="!isCordova && buyInfo" ng-if="!isCordova && buyInfo"
click-send-status="sendStatus" click-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!buyInfo || !wallet">
insufficient-funds="false"
no-matching-wallet="!buyInfo">
Confirm purchase Confirm purchase
</click-to-accept> </click-to-accept>
<slide-to-accept <slide-to-accept
ng-disabled="!buyInfo || !wallet"
ng-if="isCordova && buyInfo" ng-if="isCordova && buyInfo"
slide-on-confirm="buyConfirm()" slide-on-confirm="buyConfirm()"
slide-send-status="sendStatus" slide-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!buyInfo || !wallet">
insufficient-funds="false"
no-matching-wallet="!buyInfo">
Slide to buy Slide to buy
</slide-to-accept> </slide-to-accept>
<slide-to-accept-success <slide-to-accept-success

View File

@ -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': !wallet}"> <ion-content class="add-bottom-for-cta">
<div class="list"> <div class="list">
<div class="item head"> <div class="item head">
<div class="sending-label"> <div class="sending-label">

View File

@ -9,51 +9,51 @@
<div class="list"> <div class="list">
<div class="item head"> <div class="item head">
<div class="amount-label"> <div class="amount-label">
<div class="amount">{{displayAmount || '...'}} <span class="unit">{{displayUnit}}</span></div> <div class="amount">{{tx.amountValueStr || '...'}} <span class="unit">{{tx.amountUnitStr}}</span></div>
<div class="alternative">{{alternativeAmountStr || '...'}}</div> <div class="alternative">{{tx.alternativeAmountStr || '...'}}</div>
</div> </div>
</div> </div>
<div class="info"> <div class="info">
<div class="item single-line" ng-if="paypro.domain"> <div class="item single-line" ng-if="tx.paypro.domain">
<span class="label">{{'Pay To'|translate}}</span> <span class="label">{{'Pay To'|translate}}</span>
<span class="item-note"> <span class="item-note">
{{paypro.domain}} {{tx.paypro.domain}}
</span> </span>
</div> </div>
<div class="item single-line" ng-if="paypro.toAddress"> <div class="item single-line" ng-if="tx.paypro.toAddress">
<span class="label">{{'Address'|translate}}</span> <span class="label">{{'Address'|translate}}</span>
<span class="item-note m10l ellipsis"> <span class="item-note m10l ellipsis">
{{paypro.toAddress}} {{tx.paypro.toAddress}}
</span> </span>
</div> </div>
<div class="item"> <div class="item">
<span class="label">{{'Certified by'|translate}}</span> <span class="label">{{'Certified by'|translate}}</span>
<span class="item-note w100p"> <span class="item-note w100p">
<span ng-show="paypro.caTrusted"> <span ng-show="tx.paypro.caTrusted">
<i class="ion-locked" style="color:green"></i> <i class="ion-locked" style="color:green"></i>
{{paypro.caName}} {{'(Trusted)' | translate}}</span> {{tx.paypro.caName}} {{'(Trusted)' | translate}}</span>
</span> </span>
<span ng-show="!paypro.caTrusted"> <span ng-show="!tx.paypro.caTrusted">
<span ng-show="paypro.selfSigned"> <span ng-show="tx.paypro.selfSigned">
<i class="ion-unlocked" style="color:red"></i> <span translate>Self-signed Certificate</span> <i class="ion-unlocked" style="color:red"></i> <span translate>Self-signed Certificate</span>
</span> </span>
<span ng-show="!paypro.selfSigned"> <span ng-show="!tx.paypro.selfSigned">
<i class="ion-locked" style="color:yellow"></i>{{paypro.caName}}<br> <i class="ion-locked" style="color:yellow"></i>{{tx.paypro.caName}}<br>
<span translate>WARNING: UNTRUSTED CERTIFICATE</span> <span translate>WARNING: UNTRUSTED CERTIFICATE</span>
</span> </span>
</span> </span>
</span> </span>
</div> </div>
<div class="item" ng-if="paypro.memo"> <div class="item" ng-if="tx.paypro.memo">
<span class="label">{{'Memo'|translate}}</span> <span class="label">{{'Memo'|translate}}</span>
<span class="item-note w100p"> <span class="item-note w100p">
{{paypro.memo}} {{tx.paypro.memo}}
</span> </span>
</div> </div>
<div class="item single-line" ng-if="paypro.expires"> <div class="item single-line" ng-if="tx.paypro.expires">
<span class="label">{{'Expires'|translate}}</span> <span class="label">{{'Expires'|translate}}</span>
<span class="item-note"> <span class="item-note">
{{paypro.expires * 1000 | amTimeAgo }} {{tx.paypro.expires * 1000 | amTimeAgo }}
</span> </span>
</div> </div>
</div> </div>

View File

@ -17,11 +17,11 @@
<div class="amount-label"> <div class="amount-label">
<div class="amount">{{amountUnitStr}}</div> <div class="amount">{{amountUnitStr}}</div>
<div class="alternative" ng-if="sellPrice"> <div class="alternative" ng-if="sellPrice">
<span ng-show="isFiat">{{sellRequestInfo.amount.amount}} {{sellRequestInfo.amount.currency}}</span> <span ng-show="isFiat">{{sellRequestInfo.amount.amount}} {{sellRequestInfo.amount.currency}}</span>
@ ${{sellPrice.amount}} per BTC @ ${{sellPrice.amount}} per BTC
</div> </div>
</div> </div>
</div> </div>
<div class="info"> <div class="info">
@ -62,16 +62,16 @@
will be sent to your Coinbase account, and sold when Coinbase accepts the transaction (usually one will be sent to your Coinbase account, and sold when Coinbase accepts the transaction (usually one
hour). hour).
</div> </div>
<div class="label" ng-if="sellRequestInfo">Estimated sale value: <div class="label" ng-if="sellRequestInfo">Estimated sale value:
<strong> <strong>
{{sellRequestInfo.total.amount | currency : '' : 2}} {{sellRequestInfo.total.amount | currency : '' : 2}}
{{sellRequestInfo.total.currency}} {{sellRequestInfo.total.currency}}
</strong> </strong>
</div> </div>
<div class="label" ng-if="sellRequestInfo">Still sell if price fall until: <div class="label" ng-if="sellRequestInfo">Still sell if price fall until:
<strong> <strong>
{{(sellRequestInfo.total.amount - {{(sellRequestInfo.total.amount -
(selectedPriceSensitivity.data.value / 100) * sellRequestInfo.total.amount) | currency : '' : 2}} (selectedPriceSensitivity.data.value / 100) * sellRequestInfo.total.amount) | currency : '' : 2}}
{{sellRequestInfo.total.currency}} {{sellRequestInfo.total.currency}}
</strong> </strong>
</div> </div>
@ -107,23 +107,17 @@
</ion-content> </ion-content>
<click-to-accept <click-to-accept
ng-disabled="!selectedPaymentMethodId.value || !sellRequestInfo || !wallet"
ng-click="sellConfirm()" ng-click="sellConfirm()"
ng-if="!isCordova && sellRequestInfo" ng-if="!isCordova && sellRequestInfo"
click-send-status="sendStatus" click-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!selectedPaymentMethodId.value || !sellRequestInfo || !wallet">
insufficient-funds="!selectedPaymentMethodId.value"
no-matching-wallet="!sellRequestInfo">
Confirm sale Confirm sale
</click-to-accept> </click-to-accept>
<slide-to-accept <slide-to-accept
ng-disabled="!selectedPaymentMethodId.value || !sellRequestInfo || !wallet"
ng-if="isCordova && sellRequestInfo" ng-if="isCordova && sellRequestInfo"
slide-on-confirm="sellConfirm()" slide-on-confirm="sellConfirm()"
slide-send-status="sendStatus" slide-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!selectedPaymentMethodId.value || !sellRequestInfo || !wallet">
insufficient-funds="!selectedPaymentMethodId.value"
no-matching-wallet="!sellRequestInfo">
Slide to sell Slide to sell
</slide-to-accept> </slide-to-accept>
<slide-to-accept-success <slide-to-accept-success

View File

@ -17,12 +17,12 @@
<div class="amount-label"> <div class="amount-label">
<div class="amount">{{amountUnitStr}}</div> <div class="amount">{{amountUnitStr}}</div>
<div class="alternative"> <div class="alternative">
<span ng-show="!isFiat">{{sellInfo.subtotal}} {{sellInfo.currency}}</span> <span ng-show="!isFiat">{{sellInfo.subtotal}} {{sellInfo.currency}}</span>
<span ng-show="isFiat">{{sellInfo.qty}} BTC</span> <span ng-show="isFiat">{{sellInfo.qty}} BTC</span>
@ ${{sellInfo.price}} per BTC @ ${{sellInfo.price}} per BTC
</div> </div>
</div> </div>
</div> </div>
<div class="info"> <div class="info">
@ -64,23 +64,17 @@
</ion-content> </ion-content>
<click-to-accept <click-to-accept
ng-disabled="!sellInfo || !wallet"
ng-click="sellConfirm()" ng-click="sellConfirm()"
ng-if="!isCordova && sellInfo" ng-if="!isCordova && sellInfo"
click-send-status="sendStatus" click-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!sellInfo || !wallet">
insufficient-funds="false"
no-matching-wallet="!sellInfo">
Confirm sale Confirm sale
</click-to-accept> </click-to-accept>
<slide-to-accept <slide-to-accept
ng-disabled="!sellInfo || !wallet"
ng-if="isCordova && sellInfo" ng-if="isCordova && sellInfo"
slide-on-confirm="sellConfirm()" slide-on-confirm="sellConfirm()"
slide-send-status="sendStatus" slide-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!sellInfo || !wallet">
insufficient-funds="false"
no-matching-wallet="!sellInfo">
Slide to sell Slide to sell
</slide-to-accept> </slide-to-accept>
<slide-to-accept-success <slide-to-accept-success

View File

@ -19,7 +19,7 @@
<div class="amount-label"> <div class="amount-label">
<div class="amount-final">{{amountUnitStr}}</div> <div class="amount-final">{{amountUnitStr}}</div>
<div class="alternative"> <div class="alternative">
<span ng-if="rate">@ <span ng-if="rate">@
{{rate | currency:cardInfo.currencySymbol:2}} per BTC</span> {{rate | currency:cardInfo.currencySymbol:2}} per BTC</span>
<span ng-if="!rate">...</span> <span ng-if="!rate">...</span>
</div> </div>
@ -60,23 +60,17 @@
</ion-content> </ion-content>
<click-to-accept <click-to-accept
ng-disabled="!cardInfo || !wallet"
ng-click="topUpConfirm()" ng-click="topUpConfirm()"
ng-if="!isCordova && cardInfo" ng-if="!isCordova && cardInfo"
click-send-status="sendStatus" click-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!cardInfo || !wallet">
insufficient-funds="insufficientFunds"
no-matching-wallet="!cardInfo">
Add funds Add funds
</click-to-accept> </click-to-accept>
<slide-to-accept <slide-to-accept
ng-disabled="!cardInfo || !wallet"
ng-if="isCordova && cardInfo" ng-if="isCordova && cardInfo"
slide-on-confirm="topUpConfirm()" slide-on-confirm="topUpConfirm()"
slide-send-status="sendStatus" slide-send-status="sendStatus"
has-wallet-chosen="wallet" is-disabled="!cardInfo || !wallet">
insufficient-funds="insufficientFunds"
no-matching-wallet="!cardInfo">
Slide to confirm Slide to confirm
</slide-to-accept> </slide-to-accept>
<slide-to-accept-success <slide-to-accept-success