diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 747e08debd..f5e5743fe8 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -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."; diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index e18c13473a..860ac93c67 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -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(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 &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)) {