fix set config

This commit is contained in:
Matias Alejo Garcia 2014-12-12 11:21:48 -03:00
parent fb588117b1
commit 7d5ed4595c
5 changed files with 16 additions and 17 deletions

View File

@ -73,24 +73,23 @@ var defaultConfig = {
salt: 'jBbYTj8zTrOt6V',
},
/*
GoogleDrive: {
home: 'copay',
/*
* This clientId was generated at:
* https://console.developers.google.com/project
* To run Copay with Google Drive at your domain you need
* to generata your own Id.
*/
// This clientId was generated at:
// https://console.developers.google.com/project
// To run Copay with Google Drive at your domain you need
// to generata your own Id.
// for localhost:3001 you can use you can:
//
clientId: '232630733383-a35gcnovnkgka94394i88gq60vtjb4af.apps.googleusercontent.com',
// for copay.io:
// clientId: '1036948132229-biqm3b8sirik9lt5rtvjo9kjjpotn4ac.apps.googleusercontent.com',
},
developmentFeatures: false
*/
};
if (typeof module !== 'undefined')
module.exports = defaultConfig;

View File

@ -8,6 +8,7 @@ var ls = new LS();
// TODO move this to configService !
var config = copay.defaultConfig;
ls.getItem('config', function(err, data) {
var localConfig;
try {

View File

@ -77,7 +77,6 @@ angular.module('copayApp.controllers').controller('SettingsController', function
configService.set({
network: insightSettings,
version: copay.version,
defaultLanguage: $scope.selectedLanguage.isoCode,
plugins: plugins,
logLevel: $scope.selectedLogLevel.name,

View File

@ -5,16 +5,18 @@ angular.module('copayApp.services').factory('configService', function($timeout,
root.set = function(opts, cb) {
// Options that have runtime effects
if (opts.logLevel)
copay.logger.setLevel(opts.logLevel);
if (opts.defaultLanguage)
gettextCatalog.currentLanguage = opts.defaultLanguage;
// Set current version
opts.version = copay.version;
localstorageService.getItem('config', function(err, oldOpsStr) {
var oldOpts = {};
try {
oldOpts = JSON.parse(oldOpsStr);
} catch (e) {};
@ -24,10 +26,7 @@ angular.module('copayApp.services').factory('configService', function($timeout,
// TODO remove this global variable.
config = newOpts;
localstorageService.setItem('config', JSON.stringify(newOpts), function() {
$timeout(cb, 1);
});
localstorageService.setItem('config', JSON.stringify(newOpts), cb);
});
};

View File

@ -184,7 +184,8 @@ angular.module('copayApp.services')
w.on('ready', function() {
var isFocused = root.isFocused(wid);
copay.logger.debug('Wallet:' + w.getName() + ' is ready. Focused:', isFocused);
copay.logger.debug('Wallet:' + w.getName() +
' is ready. Focused:', isFocused);
balanceService.update(w, function() {
$rootScope.$digest();