chromeStorage fixes

This commit is contained in:
Matias Pando 2014-12-04 15:45:50 -03:00
commit 5bfbf64778
7 changed files with 44 additions and 143 deletions

View file

@ -7,23 +7,10 @@ angular.module('copayApp.controllers').controller('SettingsController', function
$scope.insightTestnet = config.network.testnet.url;
$scope.defaultLogLevel = config.logLevel || 'log';
var localStorage;
var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id;
if (isChromeApp) {
console.log('Is a chrome app!...settings.js');
localStorage = chrome.storage.local;
} else {
console.log('Is web!');
localStorage = window.localStorage;
}
var logLevels = copay.logger.getLevels();
$scope.availableLogLevels = [];
for (var key in logLevels) {
$scope.availableLogLevels.push({
'name': key
@ -75,7 +62,6 @@ angular.module('copayApp.controllers').controller('SettingsController', function
$scope.insightLivenet = copay.Insight.setCompleteUrl($scope.insightLivenet);
$scope.insightTestnet = copay.Insight.setCompleteUrl($scope.insightTestnet);
var insightSettings = {
livenet: {
url: $scope.insightLivenet,
@ -92,7 +78,6 @@ angular.module('copayApp.controllers').controller('SettingsController', function
plugins[$scope.selectedStorage.pluginName] = true;
copay.logger.setLevel($scope.selectedLogLevel.name);
localstorageService.setItem('config', JSON.stringify({
network: insightSettings,
version: copay.version,