diff --git a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp index 9213f761b..8d9512c05 100644 --- a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp +++ b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp @@ -66,6 +66,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_boxes.h" #include "styles/style_channel_earn.h" #include "styles/style_chat.h" +#include "styles/style_info.h" // infoVerifiedCheck. #include "styles/style_layers.h" #include "styles/style_menu_icons.h" #include "styles/style_window.h" @@ -1057,6 +1058,17 @@ void WebViewInstance::maybeChooseAndRequestButton(PeerTypes supported) { void WebViewInstance::show(const QString &url, uint64 queryId) { auto title = Info::Profile::NameValue(_bot); + auto titleBadge = _bot->isVerified() + ? object_ptr(_parentShow->toastParent()) + : nullptr; + if (titleBadge) { + const auto raw = titleBadge.data(); + raw->paintRequest() | rpl::start_with_next([=] { + auto p = Painter(raw); + st::infoVerifiedCheck.paint(p, st::lineWidth, 0, raw->width()); + }, raw->lifetime()); + raw->resize(st::infoVerifiedCheck.size() + QSize(0, st::lineWidth)); + } const auto &bots = _session->attachWebView().attachBots(); @@ -1087,6 +1099,7 @@ void WebViewInstance::show(const QString &url, uint64 queryId) { .url = url, .storageId = _session->local().resolveStorageIdBots(), .title = std::move(title), + .titleBadge = std::move(titleBadge), .bottom = rpl::single('@' + _bot->username()), .delegate = static_cast(this), .menuButtons = buttons, diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp index 0fed7b229..1cb0d4023 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp @@ -366,6 +366,7 @@ Panel::Progress::Progress(QWidget *parent, Fn rect) Panel::Panel( const Webview::StorageId &storageId, rpl::producer title, + object_ptr titleBadge, not_null delegate, MenuButtons menuButtons, bool allowClipboardRead) @@ -412,6 +413,7 @@ Panel::Panel( }, _widget->lifetime()); setTitle(std::move(title)); + _widget->setTitleBadge(std::move(titleBadge)); } Panel::~Panel() { @@ -1620,6 +1622,7 @@ std::unique_ptr Show(Args &&args) { auto result = std::make_unique( args.storageId, std::move(args.title), + std::move(args.titleBadge), args.delegate, args.menuButtons, args.allowClipboardRead); diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.h b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.h index 7a5901430..f03dcdc34 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.h +++ b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.h @@ -76,6 +76,7 @@ public: Panel( const Webview::StorageId &storageId, rpl::producer title, + object_ptr titleBadge, not_null delegate, MenuButtons menuButtons, bool allowClipboardRead); @@ -191,6 +192,7 @@ struct Args { QString url; Webview::StorageId storageId; rpl::producer title; + object_ptr titleBadge = { nullptr }; rpl::producer bottom; not_null delegate; MenuButtons menuButtons; diff --git a/Telegram/lib_ui b/Telegram/lib_ui index a53c0a747..3b4db4b98 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit a53c0a747ff495e0985bbb1647272c53cb29d501 +Subproject commit 3b4db4b98c1341e19cbc7b584a0243b7d6a51510