mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Show emoji statuses in channels.
This commit is contained in:
@@ -132,7 +132,7 @@ int PeerBadge::drawGetWidth(
|
||||
Expects(descriptor.customEmojiRepaint != nullptr);
|
||||
|
||||
const auto peer = descriptor.peer;
|
||||
if ((peer->isScam() || peer->isFake()) && descriptor.scam) {
|
||||
if (descriptor.scam && (peer->isScam() || peer->isFake())) {
|
||||
const auto phrase = peer->isScam()
|
||||
? tr::lng_scam_badge(tr::now)
|
||||
: tr::lng_fake_badge(tr::now);
|
||||
@@ -159,27 +159,15 @@ int PeerBadge::drawGetWidth(
|
||||
phrase,
|
||||
phraseWidth);
|
||||
return st::dialogsScamSkip + width;
|
||||
} else if (peer->isVerified() && descriptor.verified) {
|
||||
const auto iconw = descriptor.verified->width();
|
||||
descriptor.verified->paint(
|
||||
p,
|
||||
rectForName.x() + qMin(nameWidth, rectForName.width() - iconw),
|
||||
rectForName.y(),
|
||||
outerWidth);
|
||||
return iconw;
|
||||
} else if (peer->isPremium()
|
||||
&& descriptor.premium
|
||||
} else if (descriptor.premium
|
||||
&& peer->emojiStatusId()
|
||||
&& (peer->isPremium() || peer->isChannel())
|
||||
&& peer->session().premiumBadgesShown()) {
|
||||
const auto id = peer->isUser() ? peer->asUser()->emojiStatusId() : 0;
|
||||
const auto id = peer->emojiStatusId();
|
||||
const auto iconw = descriptor.premium->width();
|
||||
const auto iconx = rectForName.x()
|
||||
+ qMin(nameWidth, rectForName.width() - iconw);
|
||||
const auto icony = rectForName.y();
|
||||
if (!id) {
|
||||
_emojiStatus = nullptr;
|
||||
descriptor.premium->paint(p, iconx, icony, outerWidth);
|
||||
return iconw;
|
||||
}
|
||||
if (!_emojiStatus) {
|
||||
_emojiStatus = std::make_unique<EmojiStatus>();
|
||||
const auto size = st::emojiSize;
|
||||
@@ -205,6 +193,25 @@ int PeerBadge::drawGetWidth(
|
||||
.paused = descriptor.paused || On(PowerSaving::kEmojiStatus),
|
||||
});
|
||||
return iconw - 4 * _emojiStatus->skip;
|
||||
} else if (descriptor.verified && peer->isVerified()) {
|
||||
const auto iconw = descriptor.verified->width();
|
||||
descriptor.verified->paint(
|
||||
p,
|
||||
rectForName.x() + qMin(nameWidth, rectForName.width() - iconw),
|
||||
rectForName.y(),
|
||||
outerWidth);
|
||||
return iconw;
|
||||
} else if (descriptor.premium
|
||||
&& peer->isPremium()
|
||||
&& peer->session().premiumBadgesShown()) {
|
||||
const auto id = peer->isChat() ? 0 : peer->emojiStatusId();
|
||||
const auto iconw = descriptor.premium->width();
|
||||
const auto iconx = rectForName.x()
|
||||
+ qMin(nameWidth, rectForName.width() - iconw);
|
||||
const auto icony = rectForName.y();
|
||||
_emojiStatus = nullptr;
|
||||
descriptor.premium->paint(p, iconx, icony, outerWidth);
|
||||
return iconw;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user