mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 05:07:10 +02:00
Added peer userpic to gift service messages.
This commit is contained in:
parent
23c9f7a957
commit
f8e3e70273
2 changed files with 39 additions and 10 deletions
|
@ -255,18 +255,26 @@ auto GenerateGiftMedia(
|
|||
replacing,
|
||||
sticker,
|
||||
st::giftBoxPreviewStickerPadding));
|
||||
const auto title = v::match(descriptor, [&](GiftTypePremium gift) {
|
||||
auto title = v::match(descriptor, [&](GiftTypePremium gift) {
|
||||
return tr::lng_action_gift_premium_months(
|
||||
tr::now,
|
||||
lt_count,
|
||||
gift.months);
|
||||
gift.months,
|
||||
Text::Bold);
|
||||
}, [&](const GiftTypeStars &gift) {
|
||||
return recipient->isSelf()
|
||||
? tr::lng_action_gift_self_subtitle(tr::now)
|
||||
? tr::lng_action_gift_self_subtitle(tr::now, Text::Bold)
|
||||
: tr::lng_action_gift_got_subtitle(
|
||||
tr::now,
|
||||
lt_user,
|
||||
recipient->session().user()->shortName());
|
||||
TextWithEntities()
|
||||
.append(Text::SingleCustomEmoji(
|
||||
recipient->owner().customEmojiManager(
|
||||
).peerUserpicEmojiData(
|
||||
recipient->session().user())))
|
||||
.append(' ')
|
||||
.append(recipient->session().user()->shortName()),
|
||||
Text::Bold);
|
||||
});
|
||||
auto textFallback = v::match(descriptor, [&](GiftTypePremium gift) {
|
||||
return tr::lng_action_gift_premium_about(
|
||||
|
@ -298,15 +306,20 @@ auto GenerateGiftMedia(
|
|||
auto description = data.text.empty()
|
||||
? std::move(textFallback)
|
||||
: data.text;
|
||||
pushText(Text::Bold(title), st::giftBoxPreviewTitlePadding);
|
||||
const auto context = Core::MarkedTextContext{
|
||||
.session = &parent->history()->session(),
|
||||
.customEmojiRepaint = [parent] { parent->repaint(); },
|
||||
};
|
||||
pushText(
|
||||
std::move(title),
|
||||
st::giftBoxPreviewTitlePadding,
|
||||
{},
|
||||
context);
|
||||
pushText(
|
||||
std::move(description),
|
||||
st::giftBoxPreviewTextPadding,
|
||||
{},
|
||||
Core::MarkedTextContext{
|
||||
.session = &parent->history()->session(),
|
||||
.customEmojiRepaint = [parent] { parent->repaint(); },
|
||||
});
|
||||
context);
|
||||
|
||||
push(HistoryView::MakeGenericButtonPart(
|
||||
(data.upgraded
|
||||
|
|
|
@ -72,6 +72,17 @@ TextWithEntities PremiumGift::title() {
|
|||
const auto peer = _parent->history()->peer;
|
||||
return peer->isSelf()
|
||||
? tr::lng_action_gift_self_subtitle(tr::now, WithEntities)
|
||||
: (peer->isServiceUser() && _data.channelFrom)
|
||||
? tr::lng_action_gift_got_subtitle(
|
||||
tr::now,
|
||||
lt_user,
|
||||
WithEntities({})
|
||||
.append(SingleCustomEmoji(
|
||||
peer->owner().customEmojiManager(
|
||||
).peerUserpicEmojiData(_data.channelFrom)))
|
||||
.append(' ')
|
||||
.append(_data.channelFrom->shortName()),
|
||||
WithEntities)
|
||||
: peer->isServiceUser()
|
||||
? tr::lng_gift_link_label_gift(tr::now, WithEntities)
|
||||
: (outgoingGift()
|
||||
|
@ -79,7 +90,12 @@ TextWithEntities PremiumGift::title() {
|
|||
: tr::lng_action_gift_got_subtitle)(
|
||||
tr::now,
|
||||
lt_user,
|
||||
WithEntities(peer->shortName()),
|
||||
WithEntities({})
|
||||
.append(SingleCustomEmoji(
|
||||
peer->owner().customEmojiManager(
|
||||
).peerUserpicEmojiData(peer)))
|
||||
.append(' ')
|
||||
.append(peer->shortName()),
|
||||
WithEntities);
|
||||
} else if (creditsPrize()) {
|
||||
return tr::lng_prize_title(tr::now, WithEntities);
|
||||
|
|
Loading…
Add table
Reference in a new issue