reuse plugin
This commit is contained in:
parent
b3c3af5277
commit
723f9e89f5
2 changed files with 17 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('SettingsController', function($scope, $rootScope, $window, $route, $location, $anchorScroll, notification, applicationService) {
|
||||
angular.module('copayApp.controllers').controller('SettingsController', function($scope, $rootScope, $window, $route, $location, $anchorScroll, notification, applicationService, localstorageService) {
|
||||
$scope.title = 'Settings';
|
||||
$scope.defaultLanguage = config.defaultLanguage || 'en';
|
||||
$scope.insightLivenet = config.network.livenet.url;
|
||||
|
|
@ -80,7 +80,7 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
|||
plugins[$scope.selectedStorage.pluginName] = true;
|
||||
copay.logger.setLevel($scope.selectedLogLevel.name);
|
||||
|
||||
localStorage.setItem('config', JSON.stringify({
|
||||
localstorageService.setItem('config', JSON.stringify({
|
||||
network: insightSettings,
|
||||
version: copay.version,
|
||||
defaultLanguage: $scope.selectedLanguage.isoCode,
|
||||
|
|
@ -92,15 +92,16 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
|||
rates: _.extend(config.rates, {
|
||||
url: insightSettings.livenet.url + '/api/rates'
|
||||
}),
|
||||
}));
|
||||
|
||||
applicationService.restart();
|
||||
}), function() {
|
||||
applicationService.restart();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.reset = function() {
|
||||
localStorage.removeItem('config');
|
||||
applicationService.reload();
|
||||
localstorageService.removeItem('config', function() {
|
||||
applicationService.reload();
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
9
js/services/localstorageService.js
Normal file
9
js/services/localstorageService.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
angular.module('copayApp.services')
|
||||
.factory('localstorageService', function($rootScope) {
|
||||
var LS = require('../plugins/LocalStorage');
|
||||
var ls = new LS();
|
||||
return ls;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue