Support new updateLangPackTooLong.

GitOrigin-RevId: a3707b2b9d763a0ad58e9e7201b67f7db81cbecc
This commit is contained in:
levlam 2019-02-11 01:12:42 +03:00
parent eb7268f393
commit f67138815a
3 changed files with 12 additions and 2 deletions

View File

@ -272,6 +272,14 @@ void LanguagePackManager::on_language_pack_version_changed(int32 new_version) {
std::move(request_promise));
}
void LanguagePackManager::on_language_pack_too_long(string language_code) {
if (language_code == language_code_) {
return on_language_pack_version_changed(std::numeric_limits<int32>::max());
}
LOG(WARNING) << "Receive languagePackTooLong for language " << language_code << ", but use language "
<< language_code_;
}
void LanguagePackManager::on_update_language_pack(tl_object_ptr<telegram_api::langPackDifference> difference) {
LOG(INFO) << "Receive update language pack difference for language pack " << difference->lang_code_
<< " from version " << difference->from_version_ << " with version " << difference->version_ << " of size "

View File

@ -48,6 +48,8 @@ class LanguagePackManager : public NetQueryCallback {
void on_language_pack_version_changed(int32 new_version);
void on_language_pack_too_long(string language_code);
void get_languages(bool only_local, Promise<td_api::object_ptr<td_api::localizationTargetInfo>> promise);
void get_language_pack_strings(string language_code, vector<string> keys,

View File

@ -1856,8 +1856,8 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateContactsReset>
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateLangPackTooLong> update, bool /*force_apply*/) {
send_closure(G()->language_pack_manager(), &LanguagePackManager::on_language_pack_version_changed,
std::numeric_limits<int32>::max());
send_closure(G()->language_pack_manager(), &LanguagePackManager::on_language_pack_too_long,
std::move(update->lang_code_));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateLangPack> update, bool /*force_apply*/) {