diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 2311102df..931bbb1c0 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2369,6 +2369,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_credits_box_history_entry_play_market" = "Play Market"; "lng_credits_box_history_entry_app_store" = "App Store"; "lng_credits_box_history_entry_fragment" = "Fragment"; +"lng_credits_box_history_entry_anonymous" = "Unknown User"; +"lng_credits_box_history_entry_gift_name" = "Received Gift"; +"lng_credits_box_history_entry_gift_out_about" = "With Stars, **{user}** will be able to unlock content and services on Telegram.\n{link}"; +"lng_credits_box_history_entry_gift_in_about" = "Use Stars to unlock content and services on Telegram. {link}"; +"lng_credits_box_history_entry_gift_about_link" = "See Examples {emoji}"; +"lng_credits_box_history_entry_gift_about_url" = "https://telegram.org/blog/telegram-stars"; "lng_credits_box_history_entry_ads" = "Ads Platform"; "lng_credits_box_history_entry_premium_bot" = "Stars Top-Up"; "lng_credits_box_history_entry_via_premium_bot" = "Premium Bot"; diff --git a/Telegram/SourceFiles/api/api_credits.cpp b/Telegram/SourceFiles/api/api_credits.cpp index 356e2cffa..0b35a04ee 100644 --- a/Telegram/SourceFiles/api/api_credits.cpp +++ b/Telegram/SourceFiles/api/api_credits.cpp @@ -102,6 +102,7 @@ constexpr auto kTransactionsLimit = 100; : QDateTime(), .successLink = qs(tl.data().vtransaction_url().value_or_empty()), .in = (int64(tl.data().vstars().v) >= 0), + .gift = tl.data().is_gift(), }; } diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index fdf1eda03..5730d9b40 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -1695,8 +1695,10 @@ void AddCreditsHistoryEntryTable( AddTableRow( table, tr::lng_credits_box_history_entry_via(), - tr::lng_credits_box_history_entry_fragment( - Ui::Text::RichLangValue)); + (entry.gift + ? tr::lng_credits_box_history_entry_anonymous + : tr::lng_credits_box_history_entry_fragment)( + Ui::Text::RichLangValue)); } else if (entry.peerType == Type::Ads) { AddTableRow( table, diff --git a/Telegram/SourceFiles/data/data_credits.h b/Telegram/SourceFiles/data/data_credits.h index 75da4db5b..d01becf07 100644 --- a/Telegram/SourceFiles/data/data_credits.h +++ b/Telegram/SourceFiles/data/data_credits.h @@ -57,7 +57,7 @@ struct CreditsHistoryEntry final { QDateTime successDate; QString successLink; bool in = false; - + bool gift = false; }; struct CreditsStatusSlice final { diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp index 9c2a692e7..86640fe5b 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp @@ -800,7 +800,9 @@ void CreditsRow::init() { : _entry.failed ? (joiner + tr::lng_channel_earn_history_failed(tr::now)) : QString()) - + (_entry.title.isEmpty() ? QString() : (joiner + _name))); + + ((_entry.gift && PeerListRow::special()) + ? (joiner + tr::lng_credits_box_history_entry_anonymous(tr::now)) + : (_entry.title.isEmpty() ? QString() : (joiner + _name)))); { constexpr auto kMinus = QChar(0x2212); _rightText.setText( diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp index 1eaef4568..1f774b499 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp @@ -488,6 +488,8 @@ void ReceiptCreditsBox( rpl::single( !e.title.isEmpty() ? e.title + : e.gift + ? tr::lng_credits_box_history_entry_gift_name(tr::now) : peer ? peer->name() : Ui::GenerateEntryName(e).text), @@ -593,7 +595,41 @@ void ReceiptCreditsBox( object_ptr( box, rpl::single(e.description), - st::defaultFlatLabel))); + st::creditsBoxAbout))); + } + if (e.gift) { + Ui::AddSkip(content); + const auto arrow = Ui::Text::SingleCustomEmoji( + session->data().customEmojiManager().registerInternalEmoji( + st::topicButtonArrow, + st::channelEarnLearnArrowMargins, + false)); + auto link = tr::lng_credits_box_history_entry_gift_about_link( + lt_emoji, + rpl::single(arrow), + Ui::Text::RichLangValue + ) | rpl::map([](TextWithEntities text) { + return Ui::Text::Link( + std::move(text), + tr::lng_credits_box_history_entry_gift_about_url(tr::now)); + }); + box->addRow(object_ptr>( + box, + Ui::CreateLabelWithCustomEmoji( + box, + (!e.in && peer) + ? tr::lng_credits_box_history_entry_gift_out_about( + lt_user, + rpl::single(TextWithEntities{ peer->shortName() }), + lt_link, + std::move(link), + Ui::Text::RichLangValue) + : tr::lng_credits_box_history_entry_gift_in_about( + lt_link, + std::move(link), + Ui::Text::RichLangValue), + { .session = session }, + st::creditsBoxAbout))); } Ui::AddSkip(content); diff --git a/Telegram/SourceFiles/ui/effects/credits_graphics.cpp b/Telegram/SourceFiles/ui/effects/credits_graphics.cpp index e99a4d4eb..61b43b8fc 100644 --- a/Telegram/SourceFiles/ui/effects/credits_graphics.cpp +++ b/Telegram/SourceFiles/ui/effects/credits_graphics.cpp @@ -455,7 +455,9 @@ Fn)> PaintPreviewCallback( } TextWithEntities GenerateEntryName(const Data::CreditsHistoryEntry &entry) { - return ((entry.peerType == Data::CreditsHistoryEntry::PeerType::Fragment) + return (entry.gift + ? tr::lng_credits_box_history_entry_gift_name + : (entry.peerType == Data::CreditsHistoryEntry::PeerType::Fragment) ? tr::lng_bot_username_description1_link : (entry.peerType == Data::CreditsHistoryEntry::PeerType::PremiumBot) ? tr::lng_credits_box_history_entry_premium_bot