Added info of limited gifts to box of entry from credits earn history.

This commit is contained in:
23rd
2025-11-25 18:52:12 +03:00
parent 766db9660c
commit 8f1d40892e
2 changed files with 15 additions and 0 deletions

View File

@@ -130,6 +130,8 @@ Data::CreditsHistoryEntry CreditsHistoryEntryFromTL(
}, [](const MTPDstarsTransactionPeerAPI &) {
return Data::CreditsHistoryEntry::PeerType::API;
}),
.limitedCount = parsedGift ? parsedGift->limitedCount : 0,
.limitedLeft = parsedGift ? parsedGift->limitedLeft : 0,
.subscriptionUntil = tl.data().vsubscription_period()
? base::unixtime::parse(base::unixtime::now()
+ tl.data().vsubscription_period()->v)

View File

@@ -1780,6 +1780,19 @@ void AddCreditsHistoryEntryTable(
rpl::single(
Ui::Text::Link(entry.successLink, entry.successLink)));
}
if (entry.limitedCount > 0 && entry.limitedLeft >= 0) {
AddTableRow(
table,
tr::lng_gift_availability(),
tr::lng_gift_availability_left(
lt_count_decimal,
rpl::single(entry.limitedLeft) | tr::to_count(),
lt_amount,
rpl::single(TextWithEntities{
Lang::FormatCountDecimal(entry.limitedCount)
}),
Ui::Text::WithEntities));
}
}
void AddSubscriptionEntryTable(