From a3ca8ddcfc3c13baadc5f1d8e8bba38618802e94 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 27 Sep 2024 10:33:54 +0400 Subject: [PATCH] Support entities in star gift message in box. --- .../SourceFiles/boxes/gift_premium_box.cpp | 19 +++++++++++++++---- .../boosts/giveaway/giveaway.style | 4 ++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index a44fdade5..da4e9371d 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -1796,12 +1796,23 @@ void AddStarGiftTable( Ui::Text::WithEntities))); } if (!entry.description.empty()) { + const auto session = &controller->session(); + const auto makeContext = [=](Fn update) { + return Core::MarkedTextContext{ + .session = session, + .customEmojiRepaint = std::move(update), + }; + }; + auto label = object_ptr( + table, + rpl::single(entry.description), + st::giveawayGiftMessage, + st::defaultPopupMenu, + makeContext); + label->setSelectable(true); table->addRow( nullptr, - object_ptr( - table, - rpl::single(entry.description), - st::giveawayGiftCodeValue), + std::move(label), st::giveawayGiftCodeLabelMargin, st::giveawayGiftCodeValueMargin); } diff --git a/Telegram/SourceFiles/info/channel_statistics/boosts/giveaway/giveaway.style b/Telegram/SourceFiles/info/channel_statistics/boosts/giveaway/giveaway.style index 371edf751..d3fb04e8d 100644 --- a/Telegram/SourceFiles/info/channel_statistics/boosts/giveaway/giveaway.style +++ b/Telegram/SourceFiles/info/channel_statistics/boosts/giveaway/giveaway.style @@ -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) {