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 { int PeerListRow::nameIconWidth() const {
return (special() || !_peer->isVerified()) return special()
? 0 ? 0
: st::dialogsVerifiedIcon.width(); : _peer->isVerified()
? st::dialogsVerifiedIcon.width()
: _peer->isPremium()
? st::dialogsPremiumIcon.width()
: 0;
} }
void PeerListRow::paintNameIcon( void PeerListRow::paintNameIcon(
@ -665,7 +669,11 @@ void PeerListRow::paintNameIcon(
int y, int y,
int outerWidth, int outerWidth,
bool selected) { 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( void PeerListRow::paintStatusText(

View file

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