mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Show "Open Bot" button for main menu apps.
This commit is contained in:
parent
e6a474d720
commit
e74021fbc9
2 changed files with 13 additions and 5 deletions
|
@ -1151,8 +1151,13 @@ void AttachWebView::requestSimple(const WebViewButton &button) {
|
|||
)).done([=](const MTPSimpleWebViewResult &result) {
|
||||
_requestId = 0;
|
||||
result.match([&](const MTPDsimpleWebViewResultUrl &data) {
|
||||
const auto queryId = uint64();
|
||||
show(queryId, qs(data.vurl()), button.text);
|
||||
show(
|
||||
uint64(),
|
||||
qs(data.vurl()),
|
||||
button.text,
|
||||
false,
|
||||
nullptr,
|
||||
button.fromMainMenu);
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
|
@ -1396,7 +1401,8 @@ void AttachWebView::show(
|
|||
const QString &url,
|
||||
const QString &buttonText,
|
||||
bool allowClipboardRead,
|
||||
const BotAppData *app) {
|
||||
const BotAppData *app,
|
||||
bool fromMainMenu) {
|
||||
Expects(_bot != nullptr && _context != nullptr);
|
||||
|
||||
auto title = Info::Profile::NameValue(_bot);
|
||||
|
@ -1413,7 +1419,8 @@ void AttachWebView::show(
|
|||
&& !attached->inactive
|
||||
&& attached->hasSettings);
|
||||
const auto hasOpenBot = !_context
|
||||
|| (_bot != _context->action.history->peer);
|
||||
|| (_bot != _context->action.history->peer)
|
||||
|| fromMainMenu;
|
||||
const auto hasRemoveFromMenu = !app
|
||||
&& (attached != end(_attachBots))
|
||||
&& (!attached->inactive || attached->inMainMenu);
|
||||
|
|
|
@ -215,7 +215,8 @@ private:
|
|||
const QString &url,
|
||||
const QString &buttonText = QString(),
|
||||
bool allowClipboardRead = false,
|
||||
const BotAppData *app = nullptr);
|
||||
const BotAppData *app = nullptr,
|
||||
bool fromMainMenu = false);
|
||||
void confirmAddToMenu(
|
||||
AttachWebViewBot bot,
|
||||
Fn<void()> callback = nullptr);
|
||||
|
|
Loading…
Add table
Reference in a new issue