mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +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_reaction_name" = "Star Reaction";
|
||||||
"lng_credits_box_history_entry_subscription" = "Monthly subscription fee";
|
"lng_credits_box_history_entry_subscription" = "Monthly subscription fee";
|
||||||
"lng_credits_box_history_entry_gift_upgrade" = "Collectible Upgrade";
|
"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_subscription_section" = "My subscriptions";
|
||||||
"lng_credits_box_subscription_title" = "Subscription";
|
"lng_credits_box_subscription_title" = "Subscription";
|
||||||
|
|
|
@ -157,6 +157,7 @@ constexpr auto kTransactionsLimit = 100;
|
||||||
.converted = stargift && incoming,
|
.converted = stargift && incoming,
|
||||||
.stargift = stargift.has_value(),
|
.stargift = stargift.has_value(),
|
||||||
.giftUpgraded = tl.data().is_stargift_upgrade(),
|
.giftUpgraded = tl.data().is_stargift_upgrade(),
|
||||||
|
.giftResale = tl.data().is_stargift_resale(),
|
||||||
.reaction = tl.data().is_reaction(),
|
.reaction = tl.data().is_reaction(),
|
||||||
.refunded = tl.data().is_refund(),
|
.refunded = tl.data().is_refund(),
|
||||||
.pending = tl.data().is_pending(),
|
.pending = tl.data().is_pending(),
|
||||||
|
|
|
@ -1627,7 +1627,17 @@ void AddCreditsHistoryEntryTable(
|
||||||
const auto starrefRecipientId = PeerId(entry.starrefRecipientId);
|
const auto starrefRecipientId = PeerId(entry.starrefRecipientId);
|
||||||
const auto session = &show->session();
|
const auto session = &show->session();
|
||||||
if (entry.starrefCommission) {
|
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(
|
AddTableRow(
|
||||||
table,
|
table,
|
||||||
tr::lng_star_ref_commission_title(),
|
tr::lng_star_ref_commission_title(),
|
||||||
|
@ -1641,7 +1651,7 @@ void AddCreditsHistoryEntryTable(
|
||||||
Ui::Text::WithEntities));
|
Ui::Text::WithEntities));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (starrefRecipientId && entry.starrefAmount) {
|
if (starrefRecipientId && entry.starrefAmount && !entry.giftResale) {
|
||||||
AddTableRow(
|
AddTableRow(
|
||||||
table,
|
table,
|
||||||
tr::lng_credits_box_history_entry_affiliate(),
|
tr::lng_credits_box_history_entry_affiliate(),
|
||||||
|
@ -1651,7 +1661,9 @@ void AddCreditsHistoryEntryTable(
|
||||||
if (peerId && entry.starrefCommission) {
|
if (peerId && entry.starrefCommission) {
|
||||||
AddTableRow(
|
AddTableRow(
|
||||||
table,
|
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_referred
|
||||||
: tr::lng_credits_box_history_entry_miniapp)(),
|
: tr::lng_credits_box_history_entry_miniapp)(),
|
||||||
show,
|
show,
|
||||||
|
@ -1662,6 +1674,8 @@ void AddCreditsHistoryEntryTable(
|
||||||
? tr::lng_credits_box_history_entry_referred()
|
? tr::lng_credits_box_history_entry_referred()
|
||||||
: entry.in
|
: entry.in
|
||||||
? tr::lng_credits_box_history_entry_peer_in()
|
? tr::lng_credits_box_history_entry_peer_in()
|
||||||
|
: entry.giftResale
|
||||||
|
? tr::lng_credits_box_history_entry_gift_bought_from()
|
||||||
: entry.giftUpgraded
|
: entry.giftUpgraded
|
||||||
? tr::lng_credits_box_history_entry_gift_from()
|
? tr::lng_credits_box_history_entry_gift_from()
|
||||||
: tr::lng_credits_box_history_entry_peer();
|
: tr::lng_credits_box_history_entry_peer();
|
||||||
|
|
|
@ -95,6 +95,7 @@ struct CreditsHistoryEntry final {
|
||||||
bool giftTransferred : 1 = false;
|
bool giftTransferred : 1 = false;
|
||||||
bool giftRefunded : 1 = false;
|
bool giftRefunded : 1 = false;
|
||||||
bool giftUpgraded : 1 = false;
|
bool giftUpgraded : 1 = false;
|
||||||
|
bool giftResale : 1 = false;
|
||||||
bool giftPinned : 1 = false;
|
bool giftPinned : 1 = false;
|
||||||
bool savedToProfile : 1 = false;
|
bool savedToProfile : 1 = false;
|
||||||
bool fromGiftsList : 1 = false;
|
bool fromGiftsList : 1 = false;
|
||||||
|
|
|
@ -618,6 +618,10 @@ TextWithEntities GenerateEntryName(const Data::CreditsHistoryEntry &entry) {
|
||||||
? tr::lng_credits_box_history_entry_reaction_name
|
? tr::lng_credits_box_history_entry_reaction_name
|
||||||
: entry.giftUpgraded
|
: entry.giftUpgraded
|
||||||
? tr::lng_credits_box_history_entry_gift_upgrade
|
? 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
|
: entry.bareGiveawayMsgId
|
||||||
? tr::lng_credits_box_history_entry_giveaway_name
|
? tr::lng_credits_box_history_entry_giveaway_name
|
||||||
: entry.converted
|
: entry.converted
|
||||||
|
|
Loading…
Add table
Reference in a new issue