mirror of https://github.com/procxx/kepka.git
Apply lang pack versions from config.
This commit is contained in:
parent
36b702702b
commit
d0e48a02a1
|
@ -187,11 +187,6 @@ CloudManager::CloudManager(
|
|||
not_null<MTP::Instance*> mtproto)
|
||||
: MTP::Sender()
|
||||
, _langpack(langpack) {
|
||||
const auto current = LanguageIdOrDefault(_langpack.id());
|
||||
requestLangPackDifference(current);
|
||||
if (const auto base = _langpack.baseId(); !base.isEmpty()) {
|
||||
requestLangPackDifference(base);
|
||||
}
|
||||
}
|
||||
|
||||
Pack CloudManager::packTypeFromId(const QString &id) const {
|
||||
|
@ -292,6 +287,16 @@ void CloudManager::setSuggestedLanguage(const QString &langCode) {
|
|||
}
|
||||
}
|
||||
|
||||
void CloudManager::setCurrentVersions(int version, int baseVersion) {
|
||||
const auto check = [&](Pack pack, int version) {
|
||||
if (version > _langpack.version(pack) && !packRequestId(pack)) {
|
||||
requestLangPackDifference(pack);
|
||||
}
|
||||
};
|
||||
check(Pack::Current, version);
|
||||
check(Pack::Base, baseVersion);
|
||||
}
|
||||
|
||||
void CloudManager::applyLangPackDifference(
|
||||
const MTPLangPackDifference &difference) {
|
||||
Expects(difference.type() == mtpc_langPackDifference);
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
}
|
||||
void requestLangPackDifference(const QString &langId);
|
||||
void applyLangPackDifference(const MTPLangPackDifference &difference);
|
||||
void setCurrentVersions(int version, int baseVersion);
|
||||
|
||||
void resetToDefault();
|
||||
void switchWithWarning(const QString &id);
|
||||
|
|
|
@ -776,6 +776,13 @@ void Instance::Private::configLoadDone(const MTPConfig &result) {
|
|||
? qs(data.vsuggested_lang_code)
|
||||
: QString();
|
||||
Lang::CurrentCloudManager().setSuggestedLanguage(lang);
|
||||
Lang::CurrentCloudManager().setCurrentVersions(
|
||||
(data.has_lang_pack_version()
|
||||
? data.vlang_pack_version.v
|
||||
: 0),
|
||||
(data.has_base_lang_pack_version()
|
||||
? data.vbase_lang_pack_version.v
|
||||
: 0));
|
||||
|
||||
if (data.has_autoupdate_url_prefix()) {
|
||||
Local::writeAutoupdatePrefix(qs(data.vautoupdate_url_prefix));
|
||||
|
|
Loading…
Reference in New Issue