mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 23:57:16 +02:00
Show "Star Reaction" in stars statistics.
This commit is contained in:
parent
afe30da9f4
commit
474c0838d1
6 changed files with 20 additions and 9 deletions
|
@ -2396,6 +2396,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_credits_box_history_entry_media" = "Media";
|
||||
"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_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.";
|
||||
|
|
|
@ -94,13 +94,14 @@ constexpr auto kTransactionsLimit = 100;
|
|||
}, [](const MTPDstarsTransactionPeerAds &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::Ads;
|
||||
}),
|
||||
.refunded = tl.data().is_refund(),
|
||||
.pending = tl.data().is_pending(),
|
||||
.failed = tl.data().is_failed(),
|
||||
.successDate = tl.data().vtransaction_date()
|
||||
? base::unixtime::parse(tl.data().vtransaction_date()->v)
|
||||
: QDateTime(),
|
||||
.successLink = qs(tl.data().vtransaction_url().value_or_empty()),
|
||||
.reaction = tl.data().is_reaction(),
|
||||
.refunded = tl.data().is_refund(),
|
||||
.pending = tl.data().is_pending(),
|
||||
.failed = tl.data().is_failed(),
|
||||
.in = (int64(tl.data().vstars().v) >= 0),
|
||||
.gift = tl.data().is_gift(),
|
||||
};
|
||||
|
|
|
@ -52,11 +52,12 @@ struct CreditsHistoryEntry final {
|
|||
uint64 bareMsgId = 0;
|
||||
uint64 barePeerId = 0;
|
||||
PeerType peerType;
|
||||
QDateTime successDate;
|
||||
QString successLink;
|
||||
bool reaction = false;
|
||||
bool refunded = false;
|
||||
bool pending = false;
|
||||
bool failed = false;
|
||||
QDateTime successDate;
|
||||
QString successLink;
|
||||
bool in = false;
|
||||
bool gift = false;
|
||||
};
|
||||
|
|
|
@ -753,6 +753,7 @@ private:
|
|||
const int _rowHeight;
|
||||
|
||||
PaintRoundImageCallback _paintUserpicCallback;
|
||||
QString _title;
|
||||
QString _name;
|
||||
|
||||
Ui::Text::String _rightText;
|
||||
|
@ -787,9 +788,14 @@ CreditsRow::CreditsRow(const Descriptor &descriptor)
|
|||
}
|
||||
|
||||
void CreditsRow::init() {
|
||||
_name = !PeerListRow::special()
|
||||
const auto name = !PeerListRow::special()
|
||||
? PeerListRow::generateName()
|
||||
: Ui::GenerateEntryName(_entry).text;
|
||||
_name = _entry.reaction
|
||||
? Ui::GenerateEntryName(_entry).text
|
||||
: _entry.title.isEmpty()
|
||||
? name
|
||||
: _entry.title;
|
||||
const auto joiner = QString(QChar(' ')) + QChar(8212) + QChar(' ');
|
||||
PeerListRow::setCustomStatus(
|
||||
langDateTimeFull(_entry.date)
|
||||
|
@ -802,7 +808,7 @@ void CreditsRow::init() {
|
|||
: QString())
|
||||
+ ((_entry.gift && PeerListRow::special())
|
||||
? (joiner + tr::lng_credits_box_history_entry_anonymous(tr::now))
|
||||
: (_entry.title.isEmpty() ? QString() : (joiner + _name))));
|
||||
: ((_name == name) ? QString() : (joiner + name))));
|
||||
{
|
||||
constexpr auto kMinus = QChar(0x2212);
|
||||
_rightText.setText(
|
||||
|
|
|
@ -554,7 +554,7 @@ void ReceiptCreditsBox(
|
|||
? e.title
|
||||
: e.gift
|
||||
? tr::lng_credits_box_history_entry_gift_name(tr::now)
|
||||
: peer
|
||||
: (peer && !e.reaction)
|
||||
? peer->name()
|
||||
: Ui::GenerateEntryName(e).text),
|
||||
st::creditsBoxAboutTitle)));
|
||||
|
|
|
@ -455,7 +455,9 @@ Fn<PaintRoundImageCallback(Fn<void()>)> PaintPreviewCallback(
|
|||
}
|
||||
|
||||
TextWithEntities GenerateEntryName(const Data::CreditsHistoryEntry &entry) {
|
||||
return (entry.gift
|
||||
return (entry.reaction
|
||||
? tr::lng_credits_box_history_entry_reaction_name
|
||||
: entry.gift
|
||||
? tr::lng_credits_box_history_entry_gift_name
|
||||
: (entry.peerType == Data::CreditsHistoryEntry::PeerType::Fragment)
|
||||
? tr::lng_credits_box_history_entry_fragment
|
||||
|
|
Loading…
Add table
Reference in a new issue