Update icons for collectible wearing.

This commit is contained in:
John Preston 2025-01-14 20:41:04 +04:00
parent c6649e84a6
commit de732ba692
14 changed files with 65 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -3379,6 +3379,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_gift_wear_proof_title" = "Proof of Ownership";
"lng_gift_wear_proof_about" = "Clicking the icon of this item next to your name will show its info and owner.";
"lng_gift_wear_start" = "Start Wearing";
"lng_gift_wear_subscribe" = "Subscribe to {link} to wear collectibles.";
"lng_gift_wear_start_toast" = "You put on {name}";
"lng_gift_wear_end_toast" = "You took off {name}";

View file

@ -218,6 +218,9 @@ constexpr auto kRarityTooltipDuration = 3 * crl::time(1000);
state->content = EmojiStatusIdValue(
peer
) | rpl::map([=](EmojiStatusId emojiStatusId) {
if (!peer->session().premium()) {
return Badge::Content();
}
return Badge::Content{
.badge = BadgeType::Premium,
.emojiStatusId = emojiStatusId,
@ -232,7 +235,9 @@ constexpr auto kRarityTooltipDuration = 3 * crl::time(1000);
[=] { return show->paused(ChatHelpers::PauseReason::Layer); });
state->content.value(
) | rpl::start_with_next([=](const Badge::Content &content) {
pushStatusId(badge->widget(), content.emojiStatusId);
if (const auto widget = badge->widget()) {
pushStatusId(widget, content.emojiStatusId);
}
}, raw->lifetime());
rpl::combine(
@ -248,12 +253,14 @@ constexpr auto kRarityTooltipDuration = 3 * crl::time(1000);
label->moveToLeft(position.x(), position.y(), width);
const auto top = (raw->height() - userpic->height()) / 2;
userpic->moveToLeft(0, top, width);
badge->widget()->moveToLeft(
position.x() + label->width() + st::normalFont->spacew,
(position.y()
+ table->st().defaultValue.style.font->ascent
- table->st().smallButton.style.font->ascent),
width);
if (badgeWidget) {
badgeWidget->moveToLeft(
position.x() + label->width() + st::normalFont->spacew,
(position.y()
+ table->st().defaultValue.style.font->ascent
- table->st().smallButton.style.font->ascent),
width);
}
}, label->lifetime());
userpic->setAttribute(Qt::WA_TransparentForMouseEvents);

View file

@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_document_media.h"
#include "data/data_emoji_statuses.h"
#include "data/data_file_origin.h"
#include "data/data_peer_values.h"
#include "data/data_session.h"
#include "data/data_user.h"
#include "data/stickers/data_custom_emoji.h"
@ -2362,20 +2363,52 @@ void ShowUniqueGiftWearBox(
// &st::menuIconUniqueProfile);
infoRow(
tr::lng_gift_wear_proof_title(),
tr::lng_gift_wear_proof_about(), // todo collectibles
st.proofIcon ? st.proofIcon : &st::menuIconTradable);
tr::lng_gift_wear_proof_about(),
st.proofIcon ? st.proofIcon : &st::menuIconFactcheck);
const auto button = box->addButton(tr::lng_gift_wear_start(), [=] {
const auto session = &show->session();
const auto session = &show->session();
const auto button = box->addButton(rpl::single(QString()), [=] {
if (session->premium()) {
box->closeBox();
session->data().emojiStatuses().set(
session->user(),
session->data().emojiStatuses().fromUniqueGift(gift));
} else {
ShowPremiumPreviewBox(show, PremiumFeature::EmojiStatus);
const auto link = Ui::Text::Bold(
tr::lng_send_as_premium_required_link(tr::now));
Settings::ShowPremiumPromoToast(
show,
tr::lng_gift_wear_subscribe(
tr::now,
lt_link,
Ui::Text::Link(link),
Ui::Text::WithEntities),
u"wear_collectibles"_q);
}
});
const auto lock = Ui::Text::SingleCustomEmoji(
session->data().customEmojiManager().registerInternalEmoji(
st::historySendDisabledIcon,
st::giftBoxLockMargins,
true));
auto label = rpl::combine(
tr::lng_gift_wear_start(),
Data::AmPremiumValue(&show->session())
) | rpl::map([=](const QString &text, bool premium) {
auto result = TextWithEntities();
if (!premium) {
result.append(lock);
}
result.append(text);
return result;
});
SetButtonMarkedLabel(
button,
std::move(label),
session,
st::creditsBoxButtonLabel,
&st::giftBox.button.textFg);
rpl::combine(
box->widthValue(),
button->widthValue()

View file

@ -219,6 +219,8 @@ darkGiftCodeBox: Box(giveawayGiftCodeBox) {
darkGiftLink: icon {{ "menu/copy", groupCallMembersFg }};
darkGiftShare: icon {{ "menu/share", groupCallMembersFg }};
darkGiftTransfer: icon {{ "chat/input_replace", groupCallMembersFg }};
darkGiftNftWear: icon {{ "menu/nft_wear", groupCallMembersFg }};
darkGiftNftTakeOff: icon {{ "menu/nft_takeoff", groupCallMembersFg }};
darkGiftPalette: TextPalette(defaultTextPalette) {
linkFg: mediaviewTextLinkFg;
monoFg: groupCallMembersFg;

View file

@ -871,13 +871,13 @@ void FillUniqueGiftMenu(
if (now && unique->slug == now->slug) {
menu->addAction(tr::lng_gift_transfer_take_off(tr::now), [=] {
show->session().data().emojiStatuses().set(peer, {});
}, st.transfer ? st.transfer : &st::menuIconReplace);
}, st.takeoff ? st.takeoff : &st::menuIconNftTakeOff);
} else {
menu->addAction(tr::lng_gift_transfer_wear(tr::now), [=] {
ShowUniqueGiftWearBox(show, *unique, st.giftWearBox
? *st.giftWearBox
: GiftWearBoxStyleOverride());
}, st.transfer ? st.transfer : &st::menuIconReplace);
}, st.wear ? st.wear : &st::menuIconNftWear);
}
}
}
@ -904,6 +904,8 @@ CreditsEntryBoxStyleOverrides DarkCreditsEntryBoxStyle() {
.link = &st::darkGiftLink,
.share = &st::darkGiftShare,
.transfer = &st::darkGiftTransfer,
.wear = &st::darkGiftNftWear,
.takeoff = &st::darkGiftNftTakeOff,
.shareBox = std::make_shared<ShareBoxStyleOverrides>(
DarkShareBoxStyle()),
.giftWearBox = std::make_shared<GiftWearBoxStyleOverride>(

View file

@ -110,6 +110,8 @@ struct CreditsEntryBoxStyleOverrides {
const style::icon *link = nullptr;
const style::icon *share = nullptr;
const style::icon *transfer = nullptr;
const style::icon *wear = nullptr;
const style::icon *takeoff = nullptr;
std::shared_ptr<ShareBoxStyleOverrides> shareBox;
std::shared_ptr<GiftWearBoxStyleOverride> giftWearBox;
};

View file

@ -164,6 +164,7 @@ giftListAbout: FlatLabel(defaultFlatLabel) {
giftListAboutMargin: margins(12px, 24px, 12px, 24px);
giftBoxEmojiToggleTop: 7px;
giftBoxLimitTop: 28px;
giftBoxLockMargins: margins(-2px, 1px, 0px, 0px);
creditsHistoryEntriesList: PeerList(defaultPeerList) {
padding: margins(
@ -227,7 +228,7 @@ darkUpgradeGiftBox: Box(upgradeGiftBox) {
titleAdditionalFg: groupCallMemberNotJoinedStatus;
}
darkUpgradeGiftRadiant: icon{{ "menu/unique", groupCallMembersFg }};
darkUpgradeGiftProof: icon{{ "menu/tradable", groupCallMembersFg }};
darkUpgradeGiftProof: icon{{ "menu/factcheck", groupCallMembersFg }};
darkUpgradeGiftInfoTitle: FlatLabel(defaultFlatLabel) {
textFg: groupCallMembersFg;
}

View file

@ -173,6 +173,8 @@ menuIconTransparent: icon {{ "menu/affiliate_transparent", menuIconColor }};
menuIconLike: icon {{ "menu/affiliate_simple", menuIconColor }};
menuIconTradable: icon {{ "menu/tradable", menuIconColor }};
menuIconUnique: icon {{ "menu/unique", menuIconColor }};
menuIconNftWear: icon {{ "menu/nft_wear", menuIconColor }};
menuIconNftTakeOff: icon {{ "menu/nft_takeoff", menuIconColor }};
menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }};
menuIconTTLAnyTextPosition: point(11px, 22px);