From 4f2538be32a276861a674ab16ce30fb75d755d53 Mon Sep 17 00:00:00 2001 From: Javier Date: Thu, 22 Sep 2016 17:38:33 -0300 Subject: [PATCH] color list from config service --- public/views/preferencesColor.html | 2 +- src/js/controllers/preferencesColor.js | 25 +++-------- src/js/services/configService.js | 62 ++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 20 deletions(-) diff --git a/public/views/preferencesColor.html b/public/views/preferencesColor.html index dc2b06e78..07a66ab5f 100644 --- a/public/views/preferencesColor.html +++ b/public/views/preferencesColor.html @@ -7,7 +7,7 @@ - + {{c.name}} diff --git a/src/js/controllers/preferencesColor.js b/src/js/controllers/preferencesColor.js index c84c8ee29..da4552c00 100644 --- a/src/js/controllers/preferencesColor.js +++ b/src/js/controllers/preferencesColor.js @@ -1,31 +1,18 @@ 'use strict'; -angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $log, $stateParams, $ionicHistory, gettextCatalog, configService, profileService) { - $scope.colorList = [ - {color: "#DD4B39", name: "Cinnabar"}, - {color: "#F38F12", name: "Carrot Orange"}, - {color: "#FAA77F", name: "Light Salmon"}, - {color: "#D0B136", name: "Metallic Gold"}, - {color: "#9EDD72", name: "Feijoa"}, - {color: "#29BB9C", name: "Shamrock"}, - {color: "#019477", name: "Observatory"}, - {color: "#77DADA", name: "Turquoise Blue"}, - {color: "#4A90E2", name: "Cornflower Blue"}, - {color: "#484ED3", name: "Free Speech Blue"}, - {color: "#9B59B6", name: "Deep Lilac"}, - {color: "#E856EF", name: "Free Speech Magenta"}, - {color: "#FF599E", name: "Brilliant Rose"}, - {color: "#7A8C9E", name: "Light Slate Grey"} - ]; - +angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $timeout, $log, $stateParams, $ionicHistory, gettextCatalog, configService, profileService) { var wallet = profileService.getWallet($stateParams.walletId); $scope.wallet = wallet; var walletId = wallet.credentials.walletId; var config = configService.getSync(); + $scope.colorList = configService.getColorList(); config.colorFor = config.colorFor || {}; - $scope.currentColor = config.colorFor[walletId] || '#4A90E2'; + $timeout(function() { + $scope.$apply(); + }); + $scope.save = function(color) { var opts = { colorFor: {} diff --git a/src/js/services/configService.js b/src/js/services/configService.js index f7728c6c5..e802cd04e 100644 --- a/src/js/services/configService.js +++ b/src/js/services/configService.js @@ -89,6 +89,68 @@ angular.module('copayApp.services').factory('configService', function(storageSer var configCache = null; + var colorList = [ + { + color: "#DD4B39", + name: "Cinnabar" + }, + { + color: "#F38F12", + name: "Carrot Orange" + }, + { + color: "#FAA77F", + name: "Light Salmon" + }, + { + color: "#D0B136", + name: "Metallic Gold" + }, + { + color: "#9EDD72", + name: "Feijoa" + }, + { + color: "#29BB9C", + name: "Shamrock" + }, + { + color: "#019477", + name: "Observatory" + }, + { + color: "#77DADA", + name: "Turquoise Blue" + }, + { + color: "#4A90E2", + name: "Cornflower Blue" + }, + { + color: "#484ED3", + name: "Free Speech Blue" + }, + { + color: "#9B59B6", + name: "Deep Lilac" + }, + { + color: "#E856EF", + name: "Free Speech Magenta" + }, + { + color: "#FF599E", + name: "Brilliant Rose" + }, + { + color: "#7A8C9E", + name: "Light Slate Grey" + } + ]; + + root.getColorList = function() { + return colorList; + }; root.getSync = function() { if (!configCache)