mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 07:33:52 +02:00
Improve gift resale transaction entries.
This commit is contained in:
parent
10e4c59f2e
commit
bc3efe2f4c
5 changed files with 28 additions and 3 deletions
|
@ -2823,6 +2823,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"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_box_history_entry_gift_sold" = "Gift Sale";
|
||||
"lng_credits_box_history_entry_gift_bought" = "Gift Purchase";
|
||||
"lng_credits_box_history_entry_gift_sold_to" = "To";
|
||||
"lng_credits_box_history_entry_gift_full_price" = "Full Price";
|
||||
"lng_credits_box_history_entry_gift_bought_from" = "From";
|
||||
|
||||
"lng_credits_subscription_section" = "My subscriptions";
|
||||
"lng_credits_box_subscription_title" = "Subscription";
|
||||
|
|
|
@ -157,6 +157,7 @@ constexpr auto kTransactionsLimit = 100;
|
|||
.converted = stargift && incoming,
|
||||
.stargift = stargift.has_value(),
|
||||
.giftUpgraded = tl.data().is_stargift_upgrade(),
|
||||
.giftResale = tl.data().is_stargift_resale(),
|
||||
.reaction = tl.data().is_reaction(),
|
||||
.refunded = tl.data().is_refund(),
|
||||
.pending = tl.data().is_pending(),
|
||||
|
|
|
@ -1627,7 +1627,17 @@ void AddCreditsHistoryEntryTable(
|
|||
const auto starrefRecipientId = PeerId(entry.starrefRecipientId);
|
||||
const auto session = &show->session();
|
||||
if (entry.starrefCommission) {
|
||||
if (entry.starrefAmount) {
|
||||
if (entry.giftResale && entry.starrefCommission < 1000) {
|
||||
const auto full = int(base::SafeRound(entry.credits.value()
|
||||
/ (1. - (entry.starrefCommission / 1000.))));
|
||||
auto value = Ui::Text::IconEmoji(&st::starIconEmojiColored);
|
||||
const auto starsText = Lang::FormatStarsAmountDecimal(
|
||||
StarsAmount{ full });
|
||||
AddTableRow(
|
||||
table,
|
||||
tr::lng_credits_box_history_entry_gift_full_price(),
|
||||
rpl::single(value.append(' ' + starsText)));
|
||||
} else if (entry.starrefAmount) {
|
||||
AddTableRow(
|
||||
table,
|
||||
tr::lng_star_ref_commission_title(),
|
||||
|
@ -1641,7 +1651,7 @@ void AddCreditsHistoryEntryTable(
|
|||
Ui::Text::WithEntities));
|
||||
}
|
||||
}
|
||||
if (starrefRecipientId && entry.starrefAmount) {
|
||||
if (starrefRecipientId && entry.starrefAmount && !entry.giftResale) {
|
||||
AddTableRow(
|
||||
table,
|
||||
tr::lng_credits_box_history_entry_affiliate(),
|
||||
|
@ -1651,7 +1661,9 @@ void AddCreditsHistoryEntryTable(
|
|||
if (peerId && entry.starrefCommission) {
|
||||
AddTableRow(
|
||||
table,
|
||||
(entry.starrefAmount
|
||||
(entry.giftResale
|
||||
? tr::lng_credits_box_history_entry_gift_sold_to
|
||||
: entry.starrefAmount
|
||||
? tr::lng_credits_box_history_entry_referred
|
||||
: tr::lng_credits_box_history_entry_miniapp)(),
|
||||
show,
|
||||
|
@ -1662,6 +1674,8 @@ void AddCreditsHistoryEntryTable(
|
|||
? tr::lng_credits_box_history_entry_referred()
|
||||
: entry.in
|
||||
? tr::lng_credits_box_history_entry_peer_in()
|
||||
: entry.giftResale
|
||||
? tr::lng_credits_box_history_entry_gift_bought_from()
|
||||
: entry.giftUpgraded
|
||||
? tr::lng_credits_box_history_entry_gift_from()
|
||||
: tr::lng_credits_box_history_entry_peer();
|
||||
|
|
|
@ -95,6 +95,7 @@ struct CreditsHistoryEntry final {
|
|||
bool giftTransferred : 1 = false;
|
||||
bool giftRefunded : 1 = false;
|
||||
bool giftUpgraded : 1 = false;
|
||||
bool giftResale : 1 = false;
|
||||
bool giftPinned : 1 = false;
|
||||
bool savedToProfile : 1 = false;
|
||||
bool fromGiftsList : 1 = false;
|
||||
|
|
|
@ -618,6 +618,10 @@ TextWithEntities GenerateEntryName(const Data::CreditsHistoryEntry &entry) {
|
|||
? tr::lng_credits_box_history_entry_reaction_name
|
||||
: entry.giftUpgraded
|
||||
? tr::lng_credits_box_history_entry_gift_upgrade
|
||||
: entry.giftResale
|
||||
? (entry.in
|
||||
? tr::lng_credits_box_history_entry_gift_sold
|
||||
: tr::lng_credits_box_history_entry_gift_bought)
|
||||
: entry.bareGiveawayMsgId
|
||||
? tr::lng_credits_box_history_entry_giveaway_name
|
||||
: entry.converted
|
||||
|
|
Loading…
Add table
Reference in a new issue