mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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,
|
replacing,
|
||||||
sticker,
|
sticker,
|
||||||
st::giftBoxPreviewStickerPadding));
|
st::giftBoxPreviewStickerPadding));
|
||||||
const auto title = v::match(descriptor, [&](GiftTypePremium gift) {
|
auto title = v::match(descriptor, [&](GiftTypePremium gift) {
|
||||||
return tr::lng_action_gift_premium_months(
|
return tr::lng_action_gift_premium_months(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_count,
|
lt_count,
|
||||||
gift.months);
|
gift.months,
|
||||||
|
Text::Bold);
|
||||||
}, [&](const GiftTypeStars &gift) {
|
}, [&](const GiftTypeStars &gift) {
|
||||||
return recipient->isSelf()
|
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::lng_action_gift_got_subtitle(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_user,
|
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) {
|
auto textFallback = v::match(descriptor, [&](GiftTypePremium gift) {
|
||||||
return tr::lng_action_gift_premium_about(
|
return tr::lng_action_gift_premium_about(
|
||||||
|
@ -298,15 +306,20 @@ auto GenerateGiftMedia(
|
||||||
auto description = data.text.empty()
|
auto description = data.text.empty()
|
||||||
? std::move(textFallback)
|
? std::move(textFallback)
|
||||||
: data.text;
|
: 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(
|
pushText(
|
||||||
std::move(description),
|
std::move(description),
|
||||||
st::giftBoxPreviewTextPadding,
|
st::giftBoxPreviewTextPadding,
|
||||||
{},
|
{},
|
||||||
Core::MarkedTextContext{
|
context);
|
||||||
.session = &parent->history()->session(),
|
|
||||||
.customEmojiRepaint = [parent] { parent->repaint(); },
|
|
||||||
});
|
|
||||||
|
|
||||||
push(HistoryView::MakeGenericButtonPart(
|
push(HistoryView::MakeGenericButtonPart(
|
||||||
(data.upgraded
|
(data.upgraded
|
||||||
|
|
|
@ -72,6 +72,17 @@ TextWithEntities PremiumGift::title() {
|
||||||
const auto peer = _parent->history()->peer;
|
const auto peer = _parent->history()->peer;
|
||||||
return peer->isSelf()
|
return peer->isSelf()
|
||||||
? tr::lng_action_gift_self_subtitle(tr::now, WithEntities)
|
? 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()
|
: peer->isServiceUser()
|
||||||
? tr::lng_gift_link_label_gift(tr::now, WithEntities)
|
? tr::lng_gift_link_label_gift(tr::now, WithEntities)
|
||||||
: (outgoingGift()
|
: (outgoingGift()
|
||||||
|
@ -79,7 +90,12 @@ TextWithEntities PremiumGift::title() {
|
||||||
: tr::lng_action_gift_got_subtitle)(
|
: tr::lng_action_gift_got_subtitle)(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_user,
|
lt_user,
|
||||||
WithEntities(peer->shortName()),
|
WithEntities({})
|
||||||
|
.append(SingleCustomEmoji(
|
||||||
|
peer->owner().customEmojiManager(
|
||||||
|
).peerUserpicEmojiData(peer)))
|
||||||
|
.append(' ')
|
||||||
|
.append(peer->shortName()),
|
||||||
WithEntities);
|
WithEntities);
|
||||||
} else if (creditsPrize()) {
|
} else if (creditsPrize()) {
|
||||||
return tr::lng_prize_title(tr::now, WithEntities);
|
return tr::lng_prize_title(tr::now, WithEntities);
|
||||||
|
|
Loading…
Add table
Reference in a new issue