From b3473081376f867793a36cd3ca4754a4b2a9a210 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 29 Nov 2024 14:27:13 +0400 Subject: [PATCH] Show bot app name in title. --- Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp | 6 +++++- Telegram/SourceFiles/inline_bots/bot_attach_web_view.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp index c5bf5ce1c..7481a0bf5 100644 --- a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp +++ b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp @@ -1253,6 +1253,7 @@ void WebViewInstance::requestApp(bool allowWrite) { using Flag = MTPmessages_RequestAppWebView::Flag; const auto app = _app; + const auto title = app->title; const auto flags = Flag::f_theme_params | (_context.fullscreen ? Flag::f_fullscreen : Flag(0)) | (_appStartParam.isEmpty() ? Flag(0) : Flag::f_start_param) @@ -1269,6 +1270,7 @@ void WebViewInstance::requestApp(bool allowWrite) { const auto &data = result.data(); show({ .url = qs(data.vurl()), + .title = title, .fullscreen = data.is_fullscreen(), }); }).fail([=](const MTP::Error &error) { @@ -1350,7 +1352,9 @@ void WebViewInstance::maybeChooseAndRequestButton(PeerTypes supported) { } void WebViewInstance::show(ShowArgs &&args) { - auto title = Info::Profile::NameValue(_bot); + auto title = args.title.isEmpty() + ? Info::Profile::NameValue(_bot) + : rpl::single(args.title); auto titleBadge = _bot->isVerified() ? object_ptr(_parentShow->toastParent()) : nullptr; diff --git a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h index f0cb146a7..43dc76689 100644 --- a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h +++ b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h @@ -247,6 +247,7 @@ private: struct ShowArgs { QString url; + QString title; uint64 queryId = 0; bool fullscreen = false; };