diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index 8de3ae5f92..d60d6cca96 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -222,7 +222,14 @@ void activateBotCommand( } break; case ButtonType::WebView: { - + if (const auto m = CheckMainWidget(&msg->history()->session())) { + if (const auto bot = msg->getMessageBot()) { + m->controller()->requestAttachWebview( + bot, + bot, + button->data); + } + } } break; } } diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 39bfd1cad3..d9f277698e 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -429,12 +429,14 @@ void SessionNavigation::resolveAttachWebview( void SessionNavigation::requestAttachWebview( not_null peer, - not_null bot) { + not_null bot, + const QByteArray &url) { + using Flag = MTPmessages_RequestWebView::Flag; _api.request(MTPmessages_RequestWebView( - MTP_flags(0), + MTP_flags(url.isEmpty() ? Flag(0) : Flag::f_url), peer->input, bot->inputUser, - MTPstring(), // start_param + MTP_bytes(url), MTPDataJSON() // theme_params )).done([=](const MTPWebViewResult &result) { result.match([&](const MTPDwebViewResultUrl &data) { diff --git a/Telegram/SourceFiles/window/window_session_controller.h b/Telegram/SourceFiles/window/window_session_controller.h index 8c3cf42417..0f31a28196 100644 --- a/Telegram/SourceFiles/window/window_session_controller.h +++ b/Telegram/SourceFiles/window/window_session_controller.h @@ -208,6 +208,10 @@ public: void resolveAttachWebview( not_null peer, const QString &botUsername); + void requestAttachWebview( + not_null peer, + not_null bot, + const QByteArray &url = QByteArray()); [[nodiscard]] auto inlineResultConfirmed() const -> rpl::producer; @@ -278,9 +282,6 @@ private: not_null peer, const PeerByLinkInfo &info); - void requestAttachWebview( - not_null peer, - not_null bot); void requestAddToMenu(not_null bot, Fn callback); void showAttachWebview( not_null peer,