From f51f68efde599567bbf937e981f4430df0069476 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Wed, 9 May 2018 17:25:28 +0900 Subject: [PATCH] Fix - 244 - Limit by 8 carateres before the comma --- src/js/controllers/amount.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index ea9e444de..2d0a5aa28 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -9,7 +9,8 @@ angular.module('copayApp.controllers').controller('amountController', function($ var satToBtc; var SMALL_FONT_SIZE_LIMIT = 10; var LENGTH_EXPRESSION_LIMIT = 19; - var LENGTH_COMMA_EXPRESSION_LIMIT = 8; + var LENGTH_BEFORE_COMMA_EXPRESSION_LIMIT = 8; + var LENGTH_AFTER_COMMA_EXPRESSION_LIMIT = 8; var isNW = platformInfo.isNW; var unitIndex = 0; @@ -299,9 +300,10 @@ angular.module('copayApp.controllers').controller('amountController', function($ }; $scope.pushDigit = function(digit) { - if ($scope.amountModel.amount) { + if ($scope.amountModel.amount && digit != '.') { var amountSplitByComma = $scope.amountModel.amount.split('.'); - if (amountSplitByComma.length > 1 && amountSplitByComma[1].length >= LENGTH_COMMA_EXPRESSION_LIMIT) return; + 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;