migration from localStorage to fileStorege

This commit is contained in:
Matias Alejo Garcia 2015-04-25 14:42:17 -03:00
commit cf557fe018
4 changed files with 65 additions and 16 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('configService', function(storageService, lodash) {
angular.module('copayApp.services').factory('configService', function(storageService, lodash, $log) {
var root = {};
var defaultConfig = {
@ -48,6 +48,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer
};
root.get = function(cb) {
storageService.getConfig(function(err, localConfig) {
if (localConfig) {
configCache = JSON.parse(localConfig);
@ -61,9 +62,9 @@ angular.module('copayApp.services').factory('configService', function(storageSer
}
} else {
configCache = defaultConfig;
configCache = lodash.clone(defaultConfig);
};
$log.debug('Preferences read:', configCache)
return cb(err, configCache);
});
};