mirror of https://github.com/BTCPrivate/copay.git
fix set config
This commit is contained in:
parent
fb588117b1
commit
7d5ed4595c
17
config.js
17
config.js
|
@ -73,24 +73,23 @@ var defaultConfig = {
|
||||||
salt: 'jBbYTj8zTrOt6V',
|
salt: 'jBbYTj8zTrOt6V',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
GoogleDrive: {
|
GoogleDrive: {
|
||||||
home: 'copay',
|
home: 'copay',
|
||||||
|
|
||||||
/*
|
|
||||||
* This clientId was generated at:
|
// This clientId was generated at:
|
||||||
* https://console.developers.google.com/project
|
// https://console.developers.google.com/project
|
||||||
* To run Copay with Google Drive at your domain you need
|
// To run Copay with Google Drive at your domain you need
|
||||||
* to generata your own Id.
|
// to generata your own Id.
|
||||||
*/
|
|
||||||
// for localhost:3001 you can use you can:
|
// for localhost:3001 you can use you can:
|
||||||
|
//
|
||||||
clientId: '232630733383-a35gcnovnkgka94394i88gq60vtjb4af.apps.googleusercontent.com',
|
clientId: '232630733383-a35gcnovnkgka94394i88gq60vtjb4af.apps.googleusercontent.com',
|
||||||
|
|
||||||
// for copay.io:
|
// for copay.io:
|
||||||
// clientId: '1036948132229-biqm3b8sirik9lt5rtvjo9kjjpotn4ac.apps.googleusercontent.com',
|
// clientId: '1036948132229-biqm3b8sirik9lt5rtvjo9kjjpotn4ac.apps.googleusercontent.com',
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
developmentFeatures: false
|
|
||||||
|
|
||||||
};
|
};
|
||||||
if (typeof module !== 'undefined')
|
if (typeof module !== 'undefined')
|
||||||
module.exports = defaultConfig;
|
module.exports = defaultConfig;
|
||||||
|
|
|
@ -8,6 +8,7 @@ var ls = new LS();
|
||||||
|
|
||||||
// TODO move this to configService !
|
// TODO move this to configService !
|
||||||
var config = copay.defaultConfig;
|
var config = copay.defaultConfig;
|
||||||
|
|
||||||
ls.getItem('config', function(err, data) {
|
ls.getItem('config', function(err, data) {
|
||||||
var localConfig;
|
var localConfig;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -77,7 +77,6 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
||||||
|
|
||||||
configService.set({
|
configService.set({
|
||||||
network: insightSettings,
|
network: insightSettings,
|
||||||
version: copay.version,
|
|
||||||
defaultLanguage: $scope.selectedLanguage.isoCode,
|
defaultLanguage: $scope.selectedLanguage.isoCode,
|
||||||
plugins: plugins,
|
plugins: plugins,
|
||||||
logLevel: $scope.selectedLogLevel.name,
|
logLevel: $scope.selectedLogLevel.name,
|
||||||
|
|
|
@ -5,16 +5,18 @@ angular.module('copayApp.services').factory('configService', function($timeout,
|
||||||
|
|
||||||
root.set = function(opts, cb) {
|
root.set = function(opts, cb) {
|
||||||
|
|
||||||
|
// Options that have runtime effects
|
||||||
if (opts.logLevel)
|
if (opts.logLevel)
|
||||||
copay.logger.setLevel(opts.logLevel);
|
copay.logger.setLevel(opts.logLevel);
|
||||||
|
|
||||||
if (opts.defaultLanguage)
|
if (opts.defaultLanguage)
|
||||||
gettextCatalog.currentLanguage = opts.defaultLanguage;
|
gettextCatalog.currentLanguage = opts.defaultLanguage;
|
||||||
|
|
||||||
|
// Set current version
|
||||||
|
opts.version = copay.version;
|
||||||
|
|
||||||
localstorageService.getItem('config', function(err, oldOpsStr) {
|
localstorageService.getItem('config', function(err, oldOpsStr) {
|
||||||
|
|
||||||
var oldOpts = {};
|
var oldOpts = {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
oldOpts = JSON.parse(oldOpsStr);
|
oldOpts = JSON.parse(oldOpsStr);
|
||||||
} catch (e) {};
|
} catch (e) {};
|
||||||
|
@ -24,10 +26,7 @@ angular.module('copayApp.services').factory('configService', function($timeout,
|
||||||
|
|
||||||
// TODO remove this global variable.
|
// TODO remove this global variable.
|
||||||
config = newOpts;
|
config = newOpts;
|
||||||
|
localstorageService.setItem('config', JSON.stringify(newOpts), cb);
|
||||||
localstorageService.setItem('config', JSON.stringify(newOpts), function() {
|
|
||||||
$timeout(cb, 1);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,8 @@ angular.module('copayApp.services')
|
||||||
|
|
||||||
w.on('ready', function() {
|
w.on('ready', function() {
|
||||||
var isFocused = root.isFocused(wid);
|
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() {
|
balanceService.update(w, function() {
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
Loading…
Reference in New Issue