commit
95ee98cd65
3 changed files with 11 additions and 12 deletions
|
|
@ -9,6 +9,8 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
||||||
var satToBtc;
|
var satToBtc;
|
||||||
var SMALL_FONT_SIZE_LIMIT = 10;
|
var SMALL_FONT_SIZE_LIMIT = 10;
|
||||||
var LENGTH_EXPRESSION_LIMIT = 19;
|
var LENGTH_EXPRESSION_LIMIT = 19;
|
||||||
|
var LENGTH_BEFORE_COMMA_EXPRESSION_LIMIT = 8;
|
||||||
|
var LENGTH_AFTER_COMMA_EXPRESSION_LIMIT = 8;
|
||||||
var isNW = platformInfo.isNW;
|
var isNW = platformInfo.isNW;
|
||||||
|
|
||||||
var unitIndex = 0;
|
var unitIndex = 0;
|
||||||
|
|
@ -253,13 +255,8 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.changeUnit = function() {
|
$scope.changeUnit = function() {
|
||||||
$scope.amountModel.amount = '0';
|
|
||||||
|
|
||||||
if ($scope.alternativeAmount == 0) {
|
$scope.amountModel.amount = '0';
|
||||||
$scope.alternativeAmount = null;
|
|
||||||
} else {
|
|
||||||
$scope.amountModel.amount = parseFloat($scope.alternativeAmount.replace(/[^0-9-.]/g, ''));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fixedUnit) return;
|
if (fixedUnit) return;
|
||||||
|
|
||||||
|
|
@ -269,7 +266,6 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
||||||
}
|
}
|
||||||
|
|
||||||
if (availableUnits[unitIndex].isFiat) {
|
if (availableUnits[unitIndex].isFiat) {
|
||||||
$scope.amountModel.amount = parseFloat($scope.amountModel.amount).toFixed(2);
|
|
||||||
altUnitIndex = altUnitIndex == 0 && availableUnits.length > 2 ? 1 : 0;
|
altUnitIndex = altUnitIndex == 0 && availableUnits.length > 2 ? 1 : 0;
|
||||||
} else {
|
} else {
|
||||||
altUnitIndex = lodash.findIndex(availableUnits, {
|
altUnitIndex = lodash.findIndex(availableUnits, {
|
||||||
|
|
@ -304,6 +300,12 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.pushDigit = function(digit) {
|
$scope.pushDigit = function(digit) {
|
||||||
|
if ($scope.amountModel.amount && digit != '.') {
|
||||||
|
var amountSplitByComma = $scope.amountModel.amount.split('.');
|
||||||
|
if (amountSplitByComma.length > 1 && amountSplitByComma[1].length >= LENGTH_AFTER_COMMA_EXPRESSION_LIMIT) return;
|
||||||
|
if (amountSplitByComma.length == 1 && amountSplitByComma[0].length >= LENGTH_BEFORE_COMMA_EXPRESSION_LIMIT) return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($scope.amountModel.amount && $scope.amountModel.amount.length >= LENGTH_EXPRESSION_LIMIT) return;
|
if ($scope.amountModel.amount && $scope.amountModel.amount.length >= LENGTH_EXPRESSION_LIMIT) return;
|
||||||
if (($scope.amountModel.amount.indexOf('.') > -1 || $scope.amountModel.amount == '') && digit == '.') return;
|
if (($scope.amountModel.amount.indexOf('.') > -1 || $scope.amountModel.amount == '') && digit == '.') return;
|
||||||
if ($scope.amountModel.amount == '0' && digit == '0') return;
|
if ($scope.amountModel.amount == '0' && digit == '0') return;
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,7 @@ angular.module('copayApp.controllers').controller('tabScanController', function(
|
||||||
|
|
||||||
$scope.$on("$ionicView.afterEnter", function() {
|
$scope.$on("$ionicView.afterEnter", function() {
|
||||||
// try initializing and refreshing status any time the view is entered
|
// try initializing and refreshing status any time the view is entered
|
||||||
if(!scannerService.isInitialized()){
|
scannerService.gentleInitialize();
|
||||||
scannerService.gentleInitialize();
|
|
||||||
}
|
|
||||||
activate();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function activate(){
|
function activate(){
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(0, -50%);
|
transform: translate(0, -50%);
|
||||||
padding: 5px;
|
padding: 15px;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 18px;
|
width: 18px;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue