Support entities in star gift message in box.

This commit is contained in:
John Preston 2024-09-27 10:33:54 +04:00
parent 9ace04d2c9
commit a3ca8ddcfc
2 changed files with 19 additions and 4 deletions
Telegram/SourceFiles
boxes
info/channel_statistics/boosts/giveaway

View file

@ -1796,12 +1796,23 @@ void AddStarGiftTable(
Ui::Text::WithEntities)));
}
if (!entry.description.empty()) {
const auto session = &controller->session();
const auto makeContext = [=](Fn<void()> update) {
return Core::MarkedTextContext{
.session = session,
.customEmojiRepaint = std::move(update),
};
};
auto label = object_ptr<Ui::FlatLabel>(
table,
rpl::single(entry.description),
st::giveawayGiftMessage,
st::defaultPopupMenu,
makeContext);
label->setSelectable(true);
table->addRow(
nullptr,
object_ptr<Ui::FlatLabel>(
table,
rpl::single(entry.description),
st::giveawayGiftCodeValue),
std::move(label),
st::giveawayGiftCodeLabelMargin,
st::giveawayGiftCodeValueMargin);
}

View file

@ -97,6 +97,10 @@ giveawayGiftCodeValueMultiline: FlatLabel(giveawayGiftCodeValue) {
minWidth: 128px;
maxHeight: 100px;
}
giveawayGiftMessage: FlatLabel(giveawayGiftCodeValue) {
minWidth: 128px;
maxHeight: 0px;
}
giveawayGiftCodeValueMargin: margins(13px, 9px, 13px, 9px);
giveawayGiftCodePeerMargin: margins(11px, 6px, 11px, 4px);
giveawayGiftCodeUserpic: UserpicButton(defaultUserpicButton) {