This commit is contained in:
Javier 2016-09-05 11:54:14 -03:00
commit 1b35ec67e7
2 changed files with 7 additions and 28 deletions

View file

@ -22,7 +22,7 @@ angular.module('copayApp.controllers').controller('preferencesLanguageController
if (err) $log.warn(err);
$ionicHistory.goBack();
uxLanguage.update(function() {
uxLanguage.init(function() {
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved');
});

View file

@ -96,40 +96,19 @@ angular.module('copayApp.services')
return root.availableLanguages;
};
root.init = function() {
root.init = function(cb) {
configService.whenAvailable(function(config) {
var userLang = config.wallet.settings.defaultLanguage;
if (userLang && userLang != root.currentLanguage) {
root._set(userLang);
return;
}
root._detect(function(lang) {
root._set(lang);
});
});
};
root.update = function(cb) {
var userLang = configService.getSync().wallet.settings.defaultLanguage;
if (!userLang) {
root._detect(function(lang) {
userLang = lang;
if (userLang != root.currentLanguage) {
} else {
root._detect(function(lang) {
root._set(lang);
}
if (cb) return cb(userLang);
});
} else {
if (userLang != root.currentLanguage) {
root._set(userLang);
});
}
if (cb) return cb(userLang);
}
if (cb) return cb();
});
};
root.getName = function(lang) {