mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add proof-of-concept support for keyboardButtonWebView.
This commit is contained in:
parent
1d8aac26ce
commit
20bdbf531a
3 changed files with 17 additions and 7 deletions
|
@ -222,7 +222,14 @@ void activateBotCommand(
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case ButtonType::WebView: {
|
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;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,12 +429,14 @@ void SessionNavigation::resolveAttachWebview(
|
||||||
|
|
||||||
void SessionNavigation::requestAttachWebview(
|
void SessionNavigation::requestAttachWebview(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
not_null<UserData*> bot) {
|
not_null<UserData*> bot,
|
||||||
|
const QByteArray &url) {
|
||||||
|
using Flag = MTPmessages_RequestWebView::Flag;
|
||||||
_api.request(MTPmessages_RequestWebView(
|
_api.request(MTPmessages_RequestWebView(
|
||||||
MTP_flags(0),
|
MTP_flags(url.isEmpty() ? Flag(0) : Flag::f_url),
|
||||||
peer->input,
|
peer->input,
|
||||||
bot->inputUser,
|
bot->inputUser,
|
||||||
MTPstring(), // start_param
|
MTP_bytes(url),
|
||||||
MTPDataJSON() // theme_params
|
MTPDataJSON() // theme_params
|
||||||
)).done([=](const MTPWebViewResult &result) {
|
)).done([=](const MTPWebViewResult &result) {
|
||||||
result.match([&](const MTPDwebViewResultUrl &data) {
|
result.match([&](const MTPDwebViewResultUrl &data) {
|
||||||
|
|
|
@ -208,6 +208,10 @@ public:
|
||||||
void resolveAttachWebview(
|
void resolveAttachWebview(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
const QString &botUsername);
|
const QString &botUsername);
|
||||||
|
void requestAttachWebview(
|
||||||
|
not_null<PeerData*> peer,
|
||||||
|
not_null<UserData*> bot,
|
||||||
|
const QByteArray &url = QByteArray());
|
||||||
[[nodiscard]] auto inlineResultConfirmed() const
|
[[nodiscard]] auto inlineResultConfirmed() const
|
||||||
-> rpl::producer<InlineBots::ResultSelected>;
|
-> rpl::producer<InlineBots::ResultSelected>;
|
||||||
|
|
||||||
|
@ -278,9 +282,6 @@ private:
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
const PeerByLinkInfo &info);
|
const PeerByLinkInfo &info);
|
||||||
|
|
||||||
void requestAttachWebview(
|
|
||||||
not_null<PeerData*> peer,
|
|
||||||
not_null<UserData*> bot);
|
|
||||||
void requestAddToMenu(not_null<UserData*> bot, Fn<void()> callback);
|
void requestAddToMenu(not_null<UserData*> bot, Fn<void()> callback);
|
||||||
void showAttachWebview(
|
void showAttachWebview(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
|
|
Loading…
Add table
Reference in a new issue