Update some premium icons.

This commit is contained in:
John Preston 2022-05-20 19:28:50 +04:00
parent 9c9eae05a8
commit d81bba155a
36 changed files with 59 additions and 22 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 B

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 1,001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 538 B

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

View file

@ -1711,6 +1711,7 @@ void RevokePublicLinkBox::Inner::paintChat(
const auto badgeStyle = Ui::PeerBadgeStyle{
&st::dialogsVerifiedIcon,
nullptr, // premium
&st::attentionButtonFg
};
namew -= Ui::DrawPeerBadgeGetWidth(

View file

@ -323,15 +323,23 @@ rpl::producer<bool> CanManageGroupCallValue(not_null<PeerData*> peer) {
return rpl::single(false);
}
rpl::producer<bool> AmPremiumValue(not_null<Main::Session*> session) {
return session->user()->flagsValue(
rpl::producer<bool> PeerPremiumValue(not_null<PeerData*> peer) {
const auto user = peer->asUser();
if (!user) {
return rpl::single(false);
}
return user->flagsValue(
) | rpl::filter([=](UserData::Flags::Change change) {
return (change.diff & UserDataFlag::Premium);
}) | rpl::map([=] {
return session->user()->isPremium();
return user->isPremium();
});
}
rpl::producer<bool> AmPremiumValue(not_null<Main::Session*> session) {
return PeerPremiumValue(session->user());
}
TimeId SortByOnlineValue(not_null<UserData*> user, TimeId now) {
if (user->isServiceUser() || user->isBot()) {
return -1;

View file

@ -108,6 +108,7 @@ inline auto PeerFullFlagValue(
not_null<PeerData*> peer);
[[nodiscard]] rpl::producer<bool> CanManageGroupCallValue(
not_null<PeerData*> peer);
[[nodiscard]] rpl::producer<bool> PeerPremiumValue(not_null<PeerData*> peer);
[[nodiscard]] rpl::producer<bool> AmPremiumValue(
not_null<Main::Session*> session);

View file

@ -232,6 +232,9 @@ dialogsVerifiedIconActive: icon {
{ "dialogs/dialogs_verified_star", dialogsVerifiedIconBgActive },
{ "dialogs/dialogs_verified_check", dialogsVerifiedIconFgActive },
};
dialogsPremiumIcon: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBg }};
dialogsPremiumIconOver: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBgOver }};
dialogsPremiumIconActive: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBgActive }};
historySendingIcon: icon {{ "dialogs/dialogs_sending", historySendingOutIconFg, point(5px, 5px) }};
historySendingInvertedIcon: icon {{ "dialogs/dialogs_sending", historySendingInvertedIconFg, point(5px, 5px) }};

View file

@ -780,6 +780,11 @@ void InnerWidget::paintPeerSearchResult(
: selected
? &st::dialogsVerifiedIconOver
: &st::dialogsVerifiedIcon),
(active
? &st::dialogsPremiumIconActive
: selected
? &st::dialogsPremiumIconOver
: &st::dialogsPremiumIcon),
(active
? &st::dialogsScamFgActive
: selected

View file

@ -568,6 +568,11 @@ void paintRow(
: selected
? &st::dialogsVerifiedIconOver
: &st::dialogsVerifiedIcon),
(active
? &st::dialogsPremiumIconActive
: selected
? &st::dialogsPremiumIconOver
: &st::dialogsPremiumIcon),
(active
? &st::dialogsScamFgActive
: selected

View file

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

View file

@ -301,9 +301,10 @@ infoProfileNameLabel: FlatLabel(infoProfileStatusLabel) {
}
infoVerifiedCheckPosition: point(10px, 2px);
infoVerifiedCheck: icon {
{ "profile_verified_star", profileVerifiedCheckBg, point(0px, 0px) },
{ "profile_verified_check", profileVerifiedCheckFg, point(4px, 4px) }
{ "profile_verified_star", profileVerifiedCheckBg },
{ "profile_verified_check", profileVerifiedCheckFg }
};
infoPremiumStar: icon {{ "profile_premium", profileVerifiedCheckBg }};
infoProfileSkip: 7px;

View file

@ -356,15 +356,19 @@ void Cover::setBadge(Badge badge) {
_scamFakeBadge.destroy();
switch (_badge) {
case Badge::Verified:
case Badge::Premium: {
const auto icon = (_badge == Badge::Verified)
? &st::infoVerifiedCheck
: &st::infoPremiumStar;
_verifiedCheck.create(this);
_verifiedCheck->show();
_verifiedCheck->resize(st::infoVerifiedCheck.size());
_verifiedCheck->resize(icon->size());
_verifiedCheck->paintRequest(
) | rpl::start_with_next([check = _verifiedCheck.data()]{
) | rpl::start_with_next([icon, check = _verifiedCheck.data()] {
Painter p(check);
st::infoVerifiedCheck.paint(p, 0, 0, check->width());
}, _verifiedCheck->lifetime());
break;
icon->paint(p, 0, 0, check->width());
}, _verifiedCheck->lifetime());
} break;
case Badge::Scam:
case Badge::Fake: {
const auto fake = (_badge == Badge::Fake);

View file

@ -466,12 +466,16 @@ rpl::producer<int> AllowedReactionsCountValue(not_null<PeerData*> peer) {
template <typename Flag, typename Peer>
rpl::producer<Badge> BadgeValueFromFlags(Peer peer) {
return Data::PeerFlagsValue(
peer,
Flag::Verified | Flag::Scam | Flag::Fake
) | rpl::map([=](base::flags<Flag> value) {
return rpl::combine(
Data::PeerFlagsValue(
peer,
Flag::Verified | Flag::Scam | Flag::Fake),
Data::PeerPremiumValue(peer)
) | rpl::map([=](base::flags<Flag> value, bool premium) {
return (value & Flag::Verified)
? Badge::Verified
: premium
? Badge::Premium
: (value & Flag::Scam)
? Badge::Scam
: (value & Flag::Fake)

View file

@ -93,6 +93,7 @@ rpl::producer<not_null<PeerData*>> MigratedOrMeValue(
enum class Badge {
None,
Verified,
Premium,
Scam,
Fake,
};

View file

@ -121,12 +121,6 @@ profileReportReasonOther: InputField(defaultInputField) {
heightMax: 135px;
}
profileVerifiedCheckShift: -3px;
profileVerifiedCheck: icon {
{ "profile_verified_star", profileVerifiedCheckBg, point(0px, 7px) },
{ "profile_verified_check", profileVerifiedCheckFg, point(4px, 11px) }
};
profileCommonGroupsSkip: 24px;
profileCommonGroupsLeftMin: 24px;
profileCommonGroupsLeftMax: 36px;

View file

@ -338,7 +338,7 @@ void SetupSections(
addSection(
tr::lng_premium_summary_title(),
PremiumId(),
{ &st::settingsIconCalls, kIconGreen });
{ &st::settingsPremiumIconStar, kIconLightBlue });
AddSkip(container);
}

View file

@ -117,6 +117,14 @@ int DrawPeerBadgeGetWidth(
rectForName.y(),
outerWidth);
return iconw;
} else if (peer->isPremium() && st.premium) {
const auto iconw = st.premium->width();
st.premium->paint(
p,
rectForName.x() + qMin(nameWidth, rectForName.width() - iconw),
rectForName.y(),
outerWidth);
return iconw;
} else if ((peer->isScam() || peer->isFake()) && st.scam) {
const auto phrase = peer->isScam()
? tr::lng_scam_badge(tr::now)

View file

@ -29,6 +29,7 @@ private:
struct PeerBadgeStyle {
const style::icon *verified = nullptr;
const style::icon *premium = nullptr;
const style::color *scam = nullptr;
};
int DrawPeerBadgeGetWidth(