Add dummy handler for addtheme links.

This commit is contained in:
John Preston 2019-09-05 21:49:02 +03:00
parent ee210ea701
commit 1c313da888
2 changed files with 19 additions and 0 deletions

View File

@ -410,6 +410,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_theme_reverting#other" = "Reverting to the old theme in {count} seconds.";
"lng_theme_keep_changes" = "Keep changes";
"lng_theme_revert" = "Revert";
"lng_theme_no_desktop_version" = "Sorry, this theme doesn't include a version for Telegram Desktop.\n\n(Also, Telegram Desktop doesn't support cloud themes yet.)";
"lng_background_header" = "Background preview";
"lng_background_text1" = "Ah, you kids today with techno music! You should enjoy the classics, like Hasselhoff!";
"lng_background_text2" = "I can't even take you seriously right now.";

View File

@ -78,6 +78,18 @@ bool ShowStickerSet(
return true;
}
bool ShowTheme(
Main::Session *session,
const Match &match,
const QVariant &context) {
if (!session) {
return false;
}
Core::App().hideMediaView();
Ui::show(Box<InformBox>(tr::lng_theme_no_desktop_version(tr::now)));
return true;
}
bool SetLanguage(
Main::Session *session,
const Match &match,
@ -353,6 +365,10 @@ const std::vector<LocalUrlHandler> &LocalUrlHandlers() {
qsl("^addstickers/?\\?set=([a-zA-Z0-9\\.\\_]+)(&|$)"),
ShowStickerSet
},
{
qsl("^addtheme/?\\?slug=([a-zA-Z0-9\\.\\_]+)(&|$)"),
ShowTheme
},
{
qsl("^setlanguage/?\\?lang=([a-zA-Z0-9\\.\\_\\-]+)(&|$)"),
SetLanguage
@ -415,6 +431,8 @@ QString TryConvertUrlToLocal(QString url) {
return qsl("tg://join?invite=") + url_encode(joinChatMatch->captured(1));
} else if (auto stickerSetMatch = regex_match(qsl("^addstickers/([a-zA-Z0-9\\.\\_]+)(\\?|$)"), query, matchOptions)) {
return qsl("tg://addstickers?set=") + url_encode(stickerSetMatch->captured(1));
} else if (auto themeMatch = regex_match(qsl("^addtheme/([a-zA-Z0-9\\.\\_]+)(\\?|$)"), query, matchOptions)) {
return qsl("tg://addtheme?slug=") + url_encode(themeMatch->captured(1));
} else if (auto languageMatch = regex_match(qsl("^setlanguage/([a-zA-Z0-9\\.\\_\\-]+)(\\?|$)"), query, matchOptions)) {
return qsl("tg://setlanguage?lang=") + url_encode(languageMatch->captured(1));
} else if (auto shareUrlMatch = regex_match(qsl("^share/url/?\\?(.+)$"), query, matchOptions)) {