From 96f7d4c60a2ca6ec93eed9b8911f7d77917e06b9 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Wed, 9 May 2018 14:41:55 +0900 Subject: [PATCH 1/5] Improvement - 314 - Wrong flow on camera permissions --- src/js/controllers/tab-scan.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/js/controllers/tab-scan.js b/src/js/controllers/tab-scan.js index 1744f3d69..2fe1ab5ef 100644 --- a/src/js/controllers/tab-scan.js +++ b/src/js/controllers/tab-scan.js @@ -64,7 +64,6 @@ angular.module('copayApp.controllers').controller('tabScanController', function( if(!scannerService.isInitialized()){ scannerService.gentleInitialize(); } - activate(); }); function activate(){ From c2fda9f17720a1b045e4610f63eb468f12597961 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Wed, 9 May 2018 15:22:58 +0900 Subject: [PATCH 2/5] Improvement - 314 - Wrong flow on camera permissions --- src/js/controllers/tab-scan.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/js/controllers/tab-scan.js b/src/js/controllers/tab-scan.js index 2fe1ab5ef..c29be53ad 100644 --- a/src/js/controllers/tab-scan.js +++ b/src/js/controllers/tab-scan.js @@ -61,9 +61,7 @@ angular.module('copayApp.controllers').controller('tabScanController', function( $scope.$on("$ionicView.afterEnter", function() { // try initializing and refreshing status any time the view is entered - if(!scannerService.isInitialized()){ - scannerService.gentleInitialize(); - } + scannerService.gentleInitialize(); }); function activate(){ From 068c2a769fcfbf7981969bc98b3994baf852d868 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Wed, 9 May 2018 16:12:09 +0900 Subject: [PATCH 3/5] Improvement - 312 - Wrong flow on camera permissions --- src/js/controllers/amount.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index adbb21a61..b536252a6 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -253,12 +253,10 @@ angular.module('copayApp.controllers').controller('amountController', function($ }; $scope.changeUnit = function() { - $scope.amountModel.amount = '0'; - if ($scope.alternativeAmount == 0) { - $scope.alternativeAmount = null; - } else { - $scope.amountModel.amount = parseFloat($scope.alternativeAmount.replace(/[^0-9-.]/g, '')); + $scope.amountModel.amount = '0'; + if ($scope.alternativeAmount && $scope.alternativeAmount > 0) { + $scope.amountModel.amount = $scope.alternativeAmount; } if (fixedUnit) return; @@ -269,7 +267,6 @@ angular.module('copayApp.controllers').controller('amountController', function($ } if (availableUnits[unitIndex].isFiat) { - $scope.amountModel.amount = parseFloat($scope.amountModel.amount).toFixed(2); altUnitIndex = altUnitIndex == 0 && availableUnits.length > 2 ? 1 : 0; } else { altUnitIndex = lodash.findIndex(availableUnits, { From 3fae07d5fa21de6f33fbe3e74871efe58392797e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Wed, 9 May 2018 17:01:05 +0900 Subject: [PATCH 4/5] Fix - 244 - Clear the amount after switching, limit by 8 after comma --- src/js/controllers/amount.js | 9 ++++++--- src/sass/views/amount.scss | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index b536252a6..ea9e444de 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -9,6 +9,7 @@ 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 isNW = platformInfo.isNW; var unitIndex = 0; @@ -255,9 +256,6 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.changeUnit = function() { $scope.amountModel.amount = '0'; - if ($scope.alternativeAmount && $scope.alternativeAmount > 0) { - $scope.amountModel.amount = $scope.alternativeAmount; - } if (fixedUnit) return; @@ -301,6 +299,11 @@ angular.module('copayApp.controllers').controller('amountController', function($ }; $scope.pushDigit = function(digit) { + if ($scope.amountModel.amount) { + var amountSplitByComma = $scope.amountModel.amount.split('.'); + if (amountSplitByComma.length > 1 && amountSplitByComma[1].length >= LENGTH_COMMA_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 == '0' && digit == '0') return; diff --git a/src/sass/views/amount.scss b/src/sass/views/amount.scss index 08892c88d..26169f206 100644 --- a/src/sass/views/amount.scss +++ b/src/sass/views/amount.scss @@ -337,7 +337,7 @@ right: 0; top: 50%; transform: translate(0, -50%); - padding: 5px; + padding: 15px; img { width: 18px; From f51f68efde599567bbf937e981f4430df0069476 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Wed, 9 May 2018 17:25:28 +0900 Subject: [PATCH 5/5] 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;