2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 23:45:44 +00:00

Improve non-authed language switch.

This commit is contained in:
John Preston
2019-06-19 13:22:25 +02:00
parent a7c8feaecb
commit 52e40cbc6e
9 changed files with 61 additions and 10 deletions

View File

@@ -422,7 +422,11 @@ void CloudManager::requestLanguageAndSwitch(
_switchingToLanguageRequest = 0;
const auto language = Lang::ParseLanguage(result);
const auto finalize = [=] {
performSwitchAndRestart(language);
if (canApplyWithoutRestart(language.id)) {
performSwitchAndAddToRecent(language);
} else {
performSwitchAndRestart(language);
}
};
if (!warning) {
finalize();
@@ -452,7 +456,7 @@ void CloudManager::switchToLanguage(const Language &data) {
if (data.id == qstr("#custom")) {
performSwitchToCustom();
} else if (canApplyWithoutRestart(data.id)) {
performSwitch(data);
performSwitchAndAddToRecent(data);
} else {
QVector<MTPstring> keys;
keys.reserve(3);
@@ -545,9 +549,13 @@ void CloudManager::performSwitch(const Language &data) {
requestLangPackDifference(Pack::Base);
}
void CloudManager::performSwitchAndRestart(const Language &data) {
void CloudManager::performSwitchAndAddToRecent(const Language &data) {
Local::pushRecentLanguage(data);
performSwitch(data);
}
void CloudManager::performSwitchAndRestart(const Language &data) {
performSwitchAndAddToRecent(data);
restartAfterSwitch();
}