This commit is contained in:
Gustavo Maximiliano Cortez 2017-07-18 11:45:30 -03:00
parent b635a496d7
commit f413857a97
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
4 changed files with 48 additions and 20 deletions

View File

@ -570,7 +570,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (usingCustomFee) { if (usingCustomFee) {
scope.customFeePerKB = tx.feeRate; scope.customFeePerKB = tx.feeRate;
scope.feePerSatByte = (tx.feeRate / 1000).toFixed(); scope.feePerSatByte = tx.feeRate / 1000;
} }
$ionicModal.fromTemplateUrl('views/modals/chooseFeeLevel.html', { $ionicModal.fromTemplateUrl('views/modals/chooseFeeLevel.html', {

View File

@ -35,10 +35,13 @@ angular.module('copayApp.controllers').controller('feeLevelsController', functio
}; };
$scope.checkFees = function(feePerSatByte) { $scope.checkFees = function(feePerSatByte) {
if (parseInt(feePerSatByte) < $scope.minFeeRecommended) $scope.showMinWarning = true; if (Number(feePerSatByte) == 0) $scope.showError = true;
else $scope.showError = false;
if (Number(feePerSatByte) < $scope.minFeeRecommended) $scope.showMinWarning = true;
else $scope.showMinWarning = false; else $scope.showMinWarning = false;
if (parseInt(feePerSatByte) > $scope.maxFeeRecommended) $scope.showMaxWarning = true; if (Number(feePerSatByte) > $scope.maxFeeRecommended) $scope.showMaxWarning = true;
else $scope.showMaxWarning = false; else $scope.showMaxWarning = false;
}; };
@ -54,7 +57,7 @@ angular.module('copayApp.controllers').controller('feeLevelsController', functio
$scope.avgConfirmationTime = value.nbBlocks * 10; $scope.avgConfirmationTime = value.nbBlocks * 10;
} else { } else {
$scope.avgConfirmationTime = null; $scope.avgConfirmationTime = null;
$scope.customSatPerByte = { value: parseInt($scope.feePerSatByte) }; $scope.customSatPerByte = { value: Number($scope.feePerSatByte) };
$scope.customFeePerKB = ($scope.feePerSatByte * 1000).toFixed(); $scope.customFeePerKB = ($scope.feePerSatByte * 1000).toFixed();
} }

View File

@ -2,7 +2,7 @@
@extend .deflash-blue; @extend .deflash-blue;
.selected-fee-level { .selected-fee-level {
text-align: center; text-align: center;
background: #f2f2f2; background: #f9f9f9;
font-size: 11px; font-size: 11px;
height: 120px; height: 120px;
padding-top: 25px; padding-top: 25px;
@ -20,19 +20,39 @@
.rate .list { .rate .list {
margin-bottom: 0; margin-bottom: 0;
} }
.unit {
color: #9c9c9c; .item-input {
background: #f2f2f2; input[type="number"] {
position: absolute; text-align: right;
right: 0; padding-right: 90px;
top: 0; }
padding: 15px 10px 12px 10px; .unit {
color: #9c9c9c;
background: #f2f2f2;
position: absolute;
right: 0;
top: 0;
padding: 15px 10px 12px 10px;
}
} }
} }
.warning-fee { .warning-fee {
padding: 5px 10px;
color: $v-warning-color; color: $v-warning-color;
font-size: 12px; font-size: 12px;
text-align: left; text-align: center;
i {
margin-right: 8px;
}
}
.error-fee {
padding: 5px 10px;
color: $v-error-color;
font-size: 12px;
text-align: center;
i {
margin-right: 8px;
}
} }
.box-notification { .box-notification {
margin: 0; margin: 0;

View File

@ -4,9 +4,7 @@
{{'Bitcoin Network Fee Policy'|translate}} {{'Bitcoin Network Fee Policy'|translate}}
</div> </div>
<button <button
ng-disabled="customFeePerKB && ng-disabled="customFeePerKB && !customSatPerByte.value"
(!customSatPerByte.value ||
customSatPerByte.value > maxFeeRecommended || customSatPerByte.value < minFeeRecommended)"
class="button button-clear" ng-click="ok()" translate> class="button button-clear" ng-click="ok()" translate>
OK OK
</button> </button>
@ -41,6 +39,8 @@
<input <input
type="number" type="number"
placeholder="{{'Enter custom fee'|translate}}" placeholder="{{'Enter custom fee'|translate}}"
ng-min="0"
ng-max="maxFeeRecommended + 10000"
min="minFeeRecommended" min="minFeeRecommended"
max="maxFeeRecommended" max="maxFeeRecommended"
ng-change="checkFees(customSatPerByte.value)" ng-change="checkFees(customSatPerByte.value)"
@ -49,15 +49,20 @@
<span class="unit">sat/byte</span> <span class="unit">sat/byte</span>
</label> </label>
</div> </div>
<div class="warning-fee"> <div class="error-fee" ng-if="showError">
<i ng-if="showMinWarning || showMaxWarning" class="icon ion-alert-circled"></i> <i class="icon ion-close-circled"></i>
<span translate>
Zero value for fee are not allowed.
</span>
</div>
<div class="warning-fee" ng-if="showMinWarning || showMaxWarning">
<i class="icon ion-alert-circled"></i>
<span ng-if="showMinWarning" translate> <span ng-if="showMinWarning" translate>
Your fee is lower than recommended. Your fee is lower than recommended.
</span> </span>
<span ng-if="showMaxWarning" translate> <span ng-if="showMaxWarning" translate>
You could not set a fee higher than 1000 satoshis/byte. You should not set a fee higher than 1000 satoshis/byte.
</span> </span>
&nbsp;
</div> </div>
</div> </div>
</div> </div>