refactor
This commit is contained in:
parent
55ae03613f
commit
1b35ec67e7
2 changed files with 7 additions and 28 deletions
|
|
@ -22,7 +22,7 @@ angular.module('copayApp.controllers').controller('preferencesLanguageController
|
||||||
if (err) $log.warn(err);
|
if (err) $log.warn(err);
|
||||||
|
|
||||||
$ionicHistory.goBack();
|
$ionicHistory.goBack();
|
||||||
uxLanguage.update(function() {
|
uxLanguage.init(function() {
|
||||||
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
|
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
|
||||||
$log.debug('Remote preferences saved');
|
$log.debug('Remote preferences saved');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -96,40 +96,19 @@ angular.module('copayApp.services')
|
||||||
return root.availableLanguages;
|
return root.availableLanguages;
|
||||||
};
|
};
|
||||||
|
|
||||||
root.init = function() {
|
root.init = function(cb) {
|
||||||
configService.whenAvailable(function(config) {
|
configService.whenAvailable(function(config) {
|
||||||
var userLang = config.wallet.settings.defaultLanguage;
|
var userLang = config.wallet.settings.defaultLanguage;
|
||||||
|
|
||||||
if (userLang && userLang != root.currentLanguage) {
|
if (userLang && userLang != root.currentLanguage) {
|
||||||
root._set(userLang);
|
root._set(userLang);
|
||||||
return;
|
} else {
|
||||||
}
|
root._detect(function(lang) {
|
||||||
|
|
||||||
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) {
|
|
||||||
root._set(lang);
|
root._set(lang);
|
||||||
}
|
});
|
||||||
if (cb) return cb(userLang);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (userLang != root.currentLanguage) {
|
|
||||||
root._set(userLang);
|
|
||||||
}
|
}
|
||||||
|
if (cb) return cb();
|
||||||
if (cb) return cb(userLang);
|
});
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
root.getName = function(lang) {
|
root.getName = function(lang) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue