Show "Open Bot" button for main menu apps.
This commit is contained in:
parent
e6a474d720
commit
e74021fbc9
|
@ -1151,8 +1151,13 @@ void AttachWebView::requestSimple(const WebViewButton &button) {
|
||||||
)).done([=](const MTPSimpleWebViewResult &result) {
|
)).done([=](const MTPSimpleWebViewResult &result) {
|
||||||
_requestId = 0;
|
_requestId = 0;
|
||||||
result.match([&](const MTPDsimpleWebViewResultUrl &data) {
|
result.match([&](const MTPDsimpleWebViewResultUrl &data) {
|
||||||
const auto queryId = uint64();
|
show(
|
||||||
show(queryId, qs(data.vurl()), button.text);
|
uint64(),
|
||||||
|
qs(data.vurl()),
|
||||||
|
button.text,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
button.fromMainMenu);
|
||||||
});
|
});
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
_requestId = 0;
|
_requestId = 0;
|
||||||
|
@ -1396,7 +1401,8 @@ void AttachWebView::show(
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &buttonText,
|
const QString &buttonText,
|
||||||
bool allowClipboardRead,
|
bool allowClipboardRead,
|
||||||
const BotAppData *app) {
|
const BotAppData *app,
|
||||||
|
bool fromMainMenu) {
|
||||||
Expects(_bot != nullptr && _context != nullptr);
|
Expects(_bot != nullptr && _context != nullptr);
|
||||||
|
|
||||||
auto title = Info::Profile::NameValue(_bot);
|
auto title = Info::Profile::NameValue(_bot);
|
||||||
|
@ -1413,7 +1419,8 @@ void AttachWebView::show(
|
||||||
&& !attached->inactive
|
&& !attached->inactive
|
||||||
&& attached->hasSettings);
|
&& attached->hasSettings);
|
||||||
const auto hasOpenBot = !_context
|
const auto hasOpenBot = !_context
|
||||||
|| (_bot != _context->action.history->peer);
|
|| (_bot != _context->action.history->peer)
|
||||||
|
|| fromMainMenu;
|
||||||
const auto hasRemoveFromMenu = !app
|
const auto hasRemoveFromMenu = !app
|
||||||
&& (attached != end(_attachBots))
|
&& (attached != end(_attachBots))
|
||||||
&& (!attached->inactive || attached->inMainMenu);
|
&& (!attached->inactive || attached->inMainMenu);
|
||||||
|
|
|
@ -215,7 +215,8 @@ private:
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &buttonText = QString(),
|
const QString &buttonText = QString(),
|
||||||
bool allowClipboardRead = false,
|
bool allowClipboardRead = false,
|
||||||
const BotAppData *app = nullptr);
|
const BotAppData *app = nullptr,
|
||||||
|
bool fromMainMenu = false);
|
||||||
void confirmAddToMenu(
|
void confirmAddToMenu(
|
||||||
AttachWebViewBot bot,
|
AttachWebViewBot bot,
|
||||||
Fn<void()> callback = nullptr);
|
Fn<void()> callback = nullptr);
|
||||||
|
|
Loading…
Reference in New Issue