Fix preferencesLanguage

This commit is contained in:
Gustavo Maximiliano Cortez 2015-04-22 15:47:14 -03:00
commit 764caffd74
5 changed files with 10 additions and 7 deletions

View file

@ -42,9 +42,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
isoCode: 'ja',
}];
self.defaultLanguage = configService.getSync().wallet.settings.defaultLanguage || 'en';
self.defaultLanguageName = lodash.result(lodash.find(this.availableLanguages, { 'isoCode': self.defaultLanguage }), 'name');
self.setOngoingProcess = function(processName, isOn) {
$log.debug('onGoingProcess', processName, isOn);
self[processName] = isOn;

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $filter, $timeout, $modal, $log, configService, profileService) {
function($scope, $rootScope, $filter, $timeout, $modal, $log, lodash, configService, profileService) {
this.error = null;
this.success = null;
@ -12,7 +12,7 @@ angular.module('copayApp.controllers').controller('preferencesController',
this.selectedAlternative = {
name: config.wallet.settings.alternativeName,
isoCode: config.wallet.settings.alternativeIsoCode
};
};
var fc = profileService.focusedClient;
$scope.encrypt = fc.hasPrivKeyEncrypted();
@ -48,6 +48,11 @@ angular.module('copayApp.controllers').controller('preferencesController',
}
});
this.getDefaultLanguageName = function(availableLanguages) {
var defaultLanguage = config.wallet.settings.defaultLanguage || 'en';
return lodash.result(lodash.find(availableLanguages, { 'isoCode': defaultLanguage }), 'name');
};
$scope.$on('$destroy', function() {
unwatch();
});

View file

@ -2,6 +2,7 @@
angular.module('copayApp.controllers').controller('preferencesLanguageController',
function($scope, $timeout, configService, applicationService) {
this.defaultLanguage = configService.getSync().wallet.settings.defaultLanguage || 'en';
this.save = function(newLang) {
var opts = {