From 7f6dfcf52f29eb219118e554166383aa1e9c8661 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 30 Dec 2024 22:17:30 +0400 Subject: [PATCH] Improve new gift transactions a bit. --- Telegram/Resources/langs/lang.strings | 3 +++ Telegram/SourceFiles/api/api_credits.cpp | 1 + Telegram/SourceFiles/boxes/gift_premium_box.cpp | 2 ++ Telegram/SourceFiles/data/data_credits.h | 1 + Telegram/SourceFiles/ui/effects/credits_graphics.cpp | 6 +++++- 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 043922347..4c31964b9 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2621,6 +2621,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_credits_summary_in_toast_about#other" = "**{count}** Stars added to your balance."; "lng_credits_box_history_entry_peer" = "Recipient"; "lng_credits_box_history_entry_peer_in" = "From"; +"lng_credits_box_history_entry_gift_from" = "Gift From"; "lng_credits_box_history_entry_via" = "Via"; "lng_credits_box_history_entry_play_market" = "Play Store"; "lng_credits_box_history_entry_app_store" = "App Store"; @@ -2630,6 +2631,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_credits_box_history_entry_giveaway_name" = "Received Prize"; "lng_credits_box_history_entry_gift_sent" = "Sent Gift"; "lng_credits_box_history_entry_gift_converted" = "Converted Gift"; +"lng_credits_box_history_entry_gift_transfer" = "Gift Transfer"; "lng_credits_box_history_entry_gift_unavailable" = "Unavailable"; "lng_credits_box_history_entry_gift_sold_out" = "This gift has sold out"; "lng_credits_box_history_entry_gift_out_about" = "With Stars, **{user}** will be able to unlock content and services on Telegram.\n{link}"; @@ -2657,6 +2659,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_credits_box_history_entry_about_link" = "here"; "lng_credits_box_history_entry_reaction_name" = "Star Reaction"; "lng_credits_box_history_entry_subscription" = "Monthly subscription fee"; +"lng_credits_box_history_entry_gift_upgrade" = "Collectible Upgrade"; "lng_credits_subscription_section" = "My subscriptions"; "lng_credits_box_subscription_title" = "Subscription"; diff --git a/Telegram/SourceFiles/api/api_credits.cpp b/Telegram/SourceFiles/api/api_credits.cpp index 2bd58fc2f..7d17ca41e 100644 --- a/Telegram/SourceFiles/api/api_credits.cpp +++ b/Telegram/SourceFiles/api/api_credits.cpp @@ -144,6 +144,7 @@ constexpr auto kTransactionsLimit = 100; .floodSkip = int(tl.data().vfloodskip_number().value_or(0)), .converted = stargift && incoming, .stargift = stargift.has_value(), + .giftUpgraded = tl.data().is_stargift_upgrade(), .reaction = tl.data().is_reaction(), .refunded = tl.data().is_refund(), .pending = tl.data().is_pending(), diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index 3abe3b32e..c01d3f745 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -1541,6 +1541,8 @@ void AddCreditsHistoryEntryTable( ? tr::lng_credits_box_history_entry_referred() : entry.in ? tr::lng_credits_box_history_entry_peer_in() + : entry.giftUpgraded + ? tr::lng_credits_box_history_entry_gift_from() : tr::lng_credits_box_history_entry_peer(); AddTableRow( table, diff --git a/Telegram/SourceFiles/data/data_credits.h b/Telegram/SourceFiles/data/data_credits.h index 85ed5041e..bf25cde0e 100644 --- a/Telegram/SourceFiles/data/data_credits.h +++ b/Telegram/SourceFiles/data/data_credits.h @@ -86,6 +86,7 @@ struct CreditsHistoryEntry final { bool stargift : 1 = false; bool giftTransferred : 1 = false; bool giftRefunded : 1 = false; + bool giftUpgraded : 1 = false; bool savedToProfile : 1 = false; bool fromGiftsList : 1 = false; bool soldOutInfo : 1 = false; diff --git a/Telegram/SourceFiles/ui/effects/credits_graphics.cpp b/Telegram/SourceFiles/ui/effects/credits_graphics.cpp index e48fc5848..d472d6867 100644 --- a/Telegram/SourceFiles/ui/effects/credits_graphics.cpp +++ b/Telegram/SourceFiles/ui/effects/credits_graphics.cpp @@ -558,11 +558,15 @@ TextWithEntities GenerateEntryName(const Data::CreditsHistoryEntry &entry) { ? tr::lng_credits_box_history_entry_api : entry.reaction ? tr::lng_credits_box_history_entry_reaction_name + : entry.giftUpgraded + ? tr::lng_credits_box_history_entry_gift_upgrade : entry.bareGiveawayMsgId ? tr::lng_credits_box_history_entry_giveaway_name : entry.converted ? tr::lng_credits_box_history_entry_gift_converted - : entry.starsConverted + : (entry.gift && !entry.in && entry.uniqueGift) + ? tr::lng_credits_box_history_entry_gift_transfer + : (entry.starsConverted || (entry.gift && !entry.in)) ? tr::lng_credits_box_history_entry_gift_sent : entry.gift ? tr::lng_credits_box_history_entry_gift_name