From cf5e185f2ca2aa58ab5117b0d47624a99c092b1d Mon Sep 17 00:00:00 2001 From: Andy Phillipson Date: Fri, 24 Feb 2017 11:42:39 -0500 Subject: [PATCH] If color is not known then do not check a color. Allows user to keep color by tapping back button. Also corrects bug with case of color string comparison. --- src/js/controllers/preferencesColor.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/js/controllers/preferencesColor.js b/src/js/controllers/preferencesColor.js index 2d4e225eb..5bb68797c 100644 --- a/src/js/controllers/preferencesColor.js +++ b/src/js/controllers/preferencesColor.js @@ -37,10 +37,7 @@ angular.module('copayApp.controllers').controller('preferencesColorController', function setCurrentColorIndex() { try { - $scope.currentColorIndex = colorToIndex(config.colorFor[walletId]); - if ($scope.currentColorIndex == undefined) { - $scope.currentColorIndex = colorToIndex(getColorDefault()); - } + $scope.currentColorIndex = colorToIndex(config.colorFor[walletId] || getColorDefault()); } catch(e) { // Wait for DOM to render and try again. $timeout(function() { @@ -54,7 +51,7 @@ angular.module('copayApp.controllers').controller('preferencesColorController', function colorToIndex(color) { for (var i = 0; i < $scope.colorCount; i++) { - if (indexToColor(i) == color) { + if (indexToColor(i) == color.toLowerCase()) { return i; } }