mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Request new main web app.
This commit is contained in:
parent
5fdd4eba80
commit
a5ffd8b7cf
2 changed files with 32 additions and 2 deletions
|
@ -651,7 +651,9 @@ void WebViewInstance::resolve() {
|
||||||
}, [&](WebViewSourceLinkApp data) {
|
}, [&](WebViewSourceLinkApp data) {
|
||||||
resolveApp(data.appname, data.token, !_context.maySkipConfirmation);
|
resolveApp(data.appname, data.token, !_context.maySkipConfirmation);
|
||||||
}, [&](WebViewSourceLinkBotProfile) {
|
}, [&](WebViewSourceLinkBotProfile) {
|
||||||
requestWithMenuAdd();
|
confirmOpen([=] {
|
||||||
|
requestMain();
|
||||||
|
});
|
||||||
}, [&](WebViewSourceLinkAttachMenu data) {
|
}, [&](WebViewSourceLinkAttachMenu data) {
|
||||||
requestWithMenuAdd();
|
requestWithMenuAdd();
|
||||||
}, [&](WebViewSourceMainMenu) {
|
}, [&](WebViewSourceMainMenu) {
|
||||||
|
@ -667,7 +669,9 @@ void WebViewInstance::resolve() {
|
||||||
}, [&](WebViewSourceGame game) {
|
}, [&](WebViewSourceGame game) {
|
||||||
showGame();
|
showGame();
|
||||||
}, [&](WebViewSourceBotProfile) {
|
}, [&](WebViewSourceBotProfile) {
|
||||||
requestWithMenuAdd();
|
confirmOpen([=] {
|
||||||
|
requestMain();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,6 +872,31 @@ void WebViewInstance::requestSimple() {
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebViewInstance::requestMain() {
|
||||||
|
using Flag = MTPmessages_RequestMainWebView::Flag;
|
||||||
|
_requestId = _session->api().request(MTPmessages_RequestMainWebView(
|
||||||
|
MTP_flags(Flag::f_theme_params
|
||||||
|
| (_button.startCommand.isEmpty()
|
||||||
|
? Flag()
|
||||||
|
: Flag::f_start_param)
|
||||||
|
| (v::is<WebViewSourceLinkBotProfile>(_source)
|
||||||
|
? (v::get<WebViewSourceLinkBotProfile>(_source).compact
|
||||||
|
? Flag::f_compact
|
||||||
|
: Flag(0))
|
||||||
|
: Flag(0))),
|
||||||
|
_context.action->history->peer->input,
|
||||||
|
_bot->inputUser,
|
||||||
|
MTP_string(_button.startCommand),
|
||||||
|
MTP_dataJSON(MTP_bytes(botThemeParams().json)),
|
||||||
|
MTP_string("tdesktop")
|
||||||
|
)).done([=](const MTPWebViewResult &result) {
|
||||||
|
show(qs(result.data().vurl()));
|
||||||
|
}).fail([=](const MTP::Error &error) {
|
||||||
|
_parentShow->showToast(error.type());
|
||||||
|
close();
|
||||||
|
}).send();
|
||||||
|
}
|
||||||
|
|
||||||
void WebViewInstance::requestApp(bool allowWrite) {
|
void WebViewInstance::requestApp(bool allowWrite) {
|
||||||
Expects(_app != nullptr);
|
Expects(_app != nullptr);
|
||||||
Expects(_context.action.has_value());
|
Expects(_context.action.has_value());
|
||||||
|
|
|
@ -239,6 +239,7 @@ private:
|
||||||
|
|
||||||
void requestButton();
|
void requestButton();
|
||||||
void requestSimple();
|
void requestSimple();
|
||||||
|
void requestMain();
|
||||||
void requestApp(bool allowWrite);
|
void requestApp(bool allowWrite);
|
||||||
void requestWithMainMenuDisclaimer();
|
void requestWithMainMenuDisclaimer();
|
||||||
void requestWithMenuAdd();
|
void requestWithMenuAdd();
|
||||||
|
|
Loading…
Add table
Reference in a new issue