Improve new gift transactions a bit.

This commit is contained in:
John Preston 2024-12-30 22:17:30 +04:00
parent 92582d8434
commit 7f6dfcf52f
5 changed files with 12 additions and 1 deletions

View file

@ -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";

View file

@ -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(),

View file

@ -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,

View file

@ -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;

View file

@ -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