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.

This commit is contained in:
Andy Phillipson 2017-02-24 11:42:39 -05:00
commit cf5e185f2c

View file

@ -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;
}
}