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

View file

@ -1796,12 +1796,23 @@ void AddStarGiftTable(
Ui::Text::WithEntities))); Ui::Text::WithEntities)));
} }
if (!entry.description.empty()) { 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( table->addRow(
nullptr, nullptr,
object_ptr<Ui::FlatLabel>( std::move(label),
table,
rpl::single(entry.description),
st::giveawayGiftCodeValue),
st::giveawayGiftCodeLabelMargin, st::giveawayGiftCodeLabelMargin,
st::giveawayGiftCodeValueMargin); st::giveawayGiftCodeValueMargin);
} }

View file

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