Show premium badge in peer lists.

Fixes #24687.
This commit is contained in:
John Preston 2022-06-23 14:00:52 +04:00
parent a94c42411b
commit 2d651050ad
2 changed files with 15 additions and 6 deletions

View File

@ -654,9 +654,13 @@ void PeerListRow::invalidatePixmapsCache() {
}
int PeerListRow::nameIconWidth() const {
return (special() || !_peer->isVerified())
return special()
? 0
: st::dialogsVerifiedIcon.width();
: _peer->isVerified()
? st::dialogsVerifiedIcon.width()
: _peer->isPremium()
? st::dialogsPremiumIcon.width()
: 0;
}
void PeerListRow::paintNameIcon(
@ -665,7 +669,11 @@ void PeerListRow::paintNameIcon(
int y,
int outerWidth,
bool selected) {
st::dialogsVerifiedIcon.paint(p, x, y, outerWidth);
if (_peer->isVerified()) {
st::dialogsVerifiedIcon.paint(p, x, y, outerWidth);
} else if (_peer->isPremium()) {
st::dialogsPremiumIcon.paint(p, x, y, outerWidth);
}
}
void PeerListRow::paintStatusText(

View File

@ -513,9 +513,10 @@ void TopBarWidget::paintTopBar(Painter &p) {
const auto peer = history->peer;
const auto &text = peer->topBarNameText();
const auto badgeStyle = Ui::PeerBadgeStyle{
&st::dialogsVerifiedIcon, // verified
&st::dialogsPremiumIcon, // premium
&st::attentionButtonFg };
&st::dialogsVerifiedIcon,
&st::dialogsPremiumIcon,
&st::attentionButtonFg,
};
const auto badgeWidth = Ui::DrawPeerBadgeGetWidth(
peer,
p,