Added verified mark of web view bots to box of confirmation to open.

This commit is contained in:
23rd 2024-10-15 12:46:04 +03:00
parent 7e14277ead
commit 9077db2e97

View file

@ -384,11 +384,9 @@ void FillBotUsepic(
const auto userpic = Ui::CreateChild<Ui::UserpicButton>( const auto userpic = Ui::CreateChild<Ui::UserpicButton>(
box->verticalLayout(), box->verticalLayout(),
bot, bot,
st::mainMenuUserpic); st::infoPersonalChannelUserpic);
Ui::AddSkip(box->verticalLayout()); Ui::AddSkip(box->verticalLayout());
aboutLabel->setClickHandlerFilter([=]( aboutLabel->setClickHandlerFilter([=](auto &&...) {
const ClickHandlerPtr &,
Qt::MouseButton) {
if (const auto strong = weak.get()) { if (const auto strong = weak.get()) {
strong->showPeerHistory( strong->showPeerHistory(
bot->id, bot->id,
@ -397,14 +395,36 @@ void FillBotUsepic(
} }
return false; return false;
}); });
Ui::IconWithTitle( const auto title = Ui::CreateChild<Ui::RpWidget>(box->verticalLayout());
box->verticalLayout(), const auto titleLabel = Ui::CreateChild<Ui::FlatLabel>(
userpic, title,
Ui::CreateChild<Ui::FlatLabel>( rpl::single(bot->name()),
box->verticalLayout(), box->getDelegate()->style().title);
rpl::single(bot->name()), const auto icon = bot->isVerified() ? &st::infoVerifiedCheck : nullptr;
box->getDelegate()->style().title), title->resize(
aboutLabel); titleLabel->width() + (icon ? icon->width() : 0),
titleLabel->height());
title->widthValue(
) | rpl::distinct_until_changed() | rpl::start_with_next([=](int w) {
titleLabel->resizeToWidth(w
- (icon ? icon->width() + st::lineWidth : 0));
}, title->lifetime());
if (icon) {
title->paintRequest(
) | rpl::start_with_next([=] {
auto p = Painter(title);
p.fillRect(title->rect(), Qt::transparent);
icon->paint(
p,
std::min(
titleLabel->textMaxWidth() + st::lineWidth,
title->width() - st::lineWidth - icon->width()),
(title->height() - icon->height()) / 2,
title->width());
}, title->lifetime());
}
Ui::IconWithTitle(box->verticalLayout(), userpic, title, aboutLabel);
} }
class BotAction final : public Ui::Menu::ItemBase { class BotAction final : public Ui::Menu::ItemBase {