Added subscription date to credits history entries.

This commit is contained in:
23rd 2024-08-09 19:32:22 +03:00 committed by John Preston
parent d1313f38eb
commit cc3baad377
5 changed files with 12 additions and 2 deletions

View file

@ -2414,6 +2414,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_credits_box_history_entry_about" = "You can dispute this transaction {link}.";
"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_small_balance_title#one" = "{count} Star Needed";
"lng_credits_small_balance_title#other" = "{count} Stars Needed";
"lng_credits_small_balance_about" = "Buy **Stars** and use them on **{bot}** and other miniapps.";

View file

@ -94,6 +94,10 @@ constexpr auto kTransactionsLimit = 100;
}, [](const MTPDstarsTransactionPeerAds &) {
return Data::CreditsHistoryEntry::PeerType::Ads;
}),
.subscriptionUntil = tl.data().vsubscription_period()
? base::unixtime::parse(base::unixtime::now()
+ tl.data().vsubscription_period()->v)
: QDateTime(),
.successDate = tl.data().vtransaction_date()
? base::unixtime::parse(tl.data().vtransaction_date()->v)
: QDateTime(),

View file

@ -52,6 +52,7 @@ struct CreditsHistoryEntry final {
uint64 bareMsgId = 0;
uint64 barePeerId = 0;
PeerType peerType;
QDateTime subscriptionUntil;
QDateTime successDate;
QString successLink;
bool reaction = false;

View file

@ -805,6 +805,9 @@ void CreditsRow::init() {
? (joiner + tr::lng_channel_earn_history_pending(tr::now))
: _entry.failed
? (joiner + tr::lng_channel_earn_history_failed(tr::now))
: !_entry.subscriptionUntil.isNull()
? (joiner
+ tr::lng_credits_box_history_entry_subscription(tr::now))
: QString())
+ ((_entry.gift && PeerListRow::special())
? (joiner + tr::lng_credits_box_history_entry_anonymous(tr::now))

View file

@ -549,8 +549,9 @@ void ReceiptCreditsBox(
box,
object_ptr<Ui::FlatLabel>(
box,
rpl::single(
!e.title.isEmpty()
rpl::single(!e.subscriptionUntil.isNull()
? tr::lng_credits_box_history_entry_subscription(tr::now)
: !e.title.isEmpty()
? e.title
: e.gift
? tr::lng_credits_box_history_entry_gift_name(tr::now)