diff --git a/Telegram/Resources/icons/menu/nft_takeoff.png b/Telegram/Resources/icons/menu/nft_takeoff.png new file mode 100644 index 000000000..464d149bd Binary files /dev/null and b/Telegram/Resources/icons/menu/nft_takeoff.png differ diff --git a/Telegram/Resources/icons/menu/nft_takeoff@2x.png b/Telegram/Resources/icons/menu/nft_takeoff@2x.png new file mode 100644 index 000000000..6603a8194 Binary files /dev/null and b/Telegram/Resources/icons/menu/nft_takeoff@2x.png differ diff --git a/Telegram/Resources/icons/menu/nft_takeoff@3x.png b/Telegram/Resources/icons/menu/nft_takeoff@3x.png new file mode 100644 index 000000000..bd0d91eaf Binary files /dev/null and b/Telegram/Resources/icons/menu/nft_takeoff@3x.png differ diff --git a/Telegram/Resources/icons/menu/nft_wear.png b/Telegram/Resources/icons/menu/nft_wear.png new file mode 100644 index 000000000..868711c1b Binary files /dev/null and b/Telegram/Resources/icons/menu/nft_wear.png differ diff --git a/Telegram/Resources/icons/menu/nft_wear@2x.png b/Telegram/Resources/icons/menu/nft_wear@2x.png new file mode 100644 index 000000000..d94838dbe Binary files /dev/null and b/Telegram/Resources/icons/menu/nft_wear@2x.png differ diff --git a/Telegram/Resources/icons/menu/nft_wear@3x.png b/Telegram/Resources/icons/menu/nft_wear@3x.png new file mode 100644 index 000000000..35545df89 Binary files /dev/null and b/Telegram/Resources/icons/menu/nft_wear@3x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 07f63af25..6a25c3e92 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -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}"; diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index a6371e49d..ecf4cbc68 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -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); diff --git a/Telegram/SourceFiles/boxes/star_gift_box.cpp b/Telegram/SourceFiles/boxes/star_gift_box.cpp index e5dbcf99d..0ebdd126b 100644 --- a/Telegram/SourceFiles/boxes/star_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_box.cpp @@ -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() diff --git a/Telegram/SourceFiles/info/channel_statistics/boosts/giveaway/giveaway.style b/Telegram/SourceFiles/info/channel_statistics/boosts/giveaway/giveaway.style index fccb91fcd..3bf228c9b 100644 --- a/Telegram/SourceFiles/info/channel_statistics/boosts/giveaway/giveaway.style +++ b/Telegram/SourceFiles/info/channel_statistics/boosts/giveaway/giveaway.style @@ -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; diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp index 077c493fe..8a3f793ca 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp @@ -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( DarkShareBoxStyle()), .giftWearBox = std::make_shared( diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.h b/Telegram/SourceFiles/settings/settings_credits_graphics.h index a392f70dd..97eeaf13b 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.h +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.h @@ -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 shareBox; std::shared_ptr giftWearBox; }; diff --git a/Telegram/SourceFiles/ui/effects/credits.style b/Telegram/SourceFiles/ui/effects/credits.style index 5689aac2f..a95eb292a 100644 --- a/Telegram/SourceFiles/ui/effects/credits.style +++ b/Telegram/SourceFiles/ui/effects/credits.style @@ -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; } diff --git a/Telegram/SourceFiles/ui/menu_icons.style b/Telegram/SourceFiles/ui/menu_icons.style index f1d3c6442..90d595f16 100644 --- a/Telegram/SourceFiles/ui/menu_icons.style +++ b/Telegram/SourceFiles/ui/menu_icons.style @@ -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);