Fix color selection - IOs

This commit is contained in:
Javier 2016-06-09 17:54:03 -03:00
commit 00ef6bdb62
2 changed files with 32 additions and 38 deletions

View file

@ -2,30 +2,35 @@
angular.module('copayApp.controllers').controller('preferencesColorController',
function($scope, $timeout, $log, configService, profileService, go) {
var config = configService.getSync();
this.colorOpts = [
'#DD4B39',
'#F38F12',
'#FAA77F',
'#D0B136',
'#9EDD72',
'#29BB9C',
'#019477',
'#77DADA',
'#4A90E2',
'#484ED3',
'#9B59B6',
'#E856EF',
'#FF599E',
'#7A8C9E',
];
var config;
var fc = profileService.focusedClient;
var walletId = fc.credentials.walletId;
var config = configService.getSync();
config.colorFor = config.colorFor || {};
this.color = config.colorFor[walletId] || '#4A90E2';
this.init = function() {
this.colorList = [
'#DD4B39',
'#F38F12',
'#FAA77F',
'#D0B136',
'#9EDD72',
'#29BB9C',
'#019477',
'#77DADA',
'#4A90E2',
'#484ED3',
'#9B59B6',
'#E856EF',
'#FF599E',
'#7A8C9E',
];
config = configService.getSync();
config.colorFor = config.colorFor || {};
$scope.data = {
currentColor: config.colorFor[walletId] || '#4A90E2'
};
};
this.save = function(color) {
var self = this;
@ -35,13 +40,9 @@ angular.module('copayApp.controllers').controller('preferencesColorController',
opts.colorFor[walletId] = color;
configService.set(opts, function(err) {
if (err) $log.warn(err);
go.preferences();
if (err) $log.warn(err);
$scope.$emit('Local/ColorUpdated');
$timeout(function() {
$scope.$apply();
}, 100);
});
};
});