mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 15:17:07 +02:00
Added initial support of received gifts in list of credits history.
This commit is contained in:
parent
5c797d1f31
commit
847d66c973
7 changed files with 55 additions and 6 deletions
Telegram
Resources/langs
SourceFiles
api
boxes
data
info/statistics
settings
ui/effects
|
@ -2369,6 +2369,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_credits_box_history_entry_play_market" = "Play Market";
|
||||
"lng_credits_box_history_entry_app_store" = "App Store";
|
||||
"lng_credits_box_history_entry_fragment" = "Fragment";
|
||||
"lng_credits_box_history_entry_anonymous" = "Unknown User";
|
||||
"lng_credits_box_history_entry_gift_name" = "Received Gift";
|
||||
"lng_credits_box_history_entry_gift_out_about" = "With Stars, **{user}** will be able to unlock content and services on Telegram.\n{link}";
|
||||
"lng_credits_box_history_entry_gift_in_about" = "Use Stars to unlock content and services on Telegram. {link}";
|
||||
"lng_credits_box_history_entry_gift_about_link" = "See Examples {emoji}";
|
||||
"lng_credits_box_history_entry_gift_about_url" = "https://telegram.org/blog/telegram-stars";
|
||||
"lng_credits_box_history_entry_ads" = "Ads Platform";
|
||||
"lng_credits_box_history_entry_premium_bot" = "Stars Top-Up";
|
||||
"lng_credits_box_history_entry_via_premium_bot" = "Premium Bot";
|
||||
|
|
|
@ -102,6 +102,7 @@ constexpr auto kTransactionsLimit = 100;
|
|||
: QDateTime(),
|
||||
.successLink = qs(tl.data().vtransaction_url().value_or_empty()),
|
||||
.in = (int64(tl.data().vstars().v) >= 0),
|
||||
.gift = tl.data().is_gift(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1695,8 +1695,10 @@ void AddCreditsHistoryEntryTable(
|
|||
AddTableRow(
|
||||
table,
|
||||
tr::lng_credits_box_history_entry_via(),
|
||||
tr::lng_credits_box_history_entry_fragment(
|
||||
Ui::Text::RichLangValue));
|
||||
(entry.gift
|
||||
? tr::lng_credits_box_history_entry_anonymous
|
||||
: tr::lng_credits_box_history_entry_fragment)(
|
||||
Ui::Text::RichLangValue));
|
||||
} else if (entry.peerType == Type::Ads) {
|
||||
AddTableRow(
|
||||
table,
|
||||
|
|
|
@ -57,7 +57,7 @@ struct CreditsHistoryEntry final {
|
|||
QDateTime successDate;
|
||||
QString successLink;
|
||||
bool in = false;
|
||||
|
||||
bool gift = false;
|
||||
};
|
||||
|
||||
struct CreditsStatusSlice final {
|
||||
|
|
|
@ -800,7 +800,9 @@ void CreditsRow::init() {
|
|||
: _entry.failed
|
||||
? (joiner + tr::lng_channel_earn_history_failed(tr::now))
|
||||
: QString())
|
||||
+ (_entry.title.isEmpty() ? QString() : (joiner + _name)));
|
||||
+ ((_entry.gift && PeerListRow::special())
|
||||
? (joiner + tr::lng_credits_box_history_entry_anonymous(tr::now))
|
||||
: (_entry.title.isEmpty() ? QString() : (joiner + _name))));
|
||||
{
|
||||
constexpr auto kMinus = QChar(0x2212);
|
||||
_rightText.setText(
|
||||
|
|
|
@ -488,6 +488,8 @@ void ReceiptCreditsBox(
|
|||
rpl::single(
|
||||
!e.title.isEmpty()
|
||||
? e.title
|
||||
: e.gift
|
||||
? tr::lng_credits_box_history_entry_gift_name(tr::now)
|
||||
: peer
|
||||
? peer->name()
|
||||
: Ui::GenerateEntryName(e).text),
|
||||
|
@ -593,7 +595,41 @@ void ReceiptCreditsBox(
|
|||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
rpl::single(e.description),
|
||||
st::defaultFlatLabel)));
|
||||
st::creditsBoxAbout)));
|
||||
}
|
||||
if (e.gift) {
|
||||
Ui::AddSkip(content);
|
||||
const auto arrow = Ui::Text::SingleCustomEmoji(
|
||||
session->data().customEmojiManager().registerInternalEmoji(
|
||||
st::topicButtonArrow,
|
||||
st::channelEarnLearnArrowMargins,
|
||||
false));
|
||||
auto link = tr::lng_credits_box_history_entry_gift_about_link(
|
||||
lt_emoji,
|
||||
rpl::single(arrow),
|
||||
Ui::Text::RichLangValue
|
||||
) | rpl::map([](TextWithEntities text) {
|
||||
return Ui::Text::Link(
|
||||
std::move(text),
|
||||
tr::lng_credits_box_history_entry_gift_about_url(tr::now));
|
||||
});
|
||||
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||
box,
|
||||
Ui::CreateLabelWithCustomEmoji(
|
||||
box,
|
||||
(!e.in && peer)
|
||||
? tr::lng_credits_box_history_entry_gift_out_about(
|
||||
lt_user,
|
||||
rpl::single(TextWithEntities{ peer->shortName() }),
|
||||
lt_link,
|
||||
std::move(link),
|
||||
Ui::Text::RichLangValue)
|
||||
: tr::lng_credits_box_history_entry_gift_in_about(
|
||||
lt_link,
|
||||
std::move(link),
|
||||
Ui::Text::RichLangValue),
|
||||
{ .session = session },
|
||||
st::creditsBoxAbout)));
|
||||
}
|
||||
|
||||
Ui::AddSkip(content);
|
||||
|
|
|
@ -455,7 +455,9 @@ Fn<PaintRoundImageCallback(Fn<void()>)> PaintPreviewCallback(
|
|||
}
|
||||
|
||||
TextWithEntities GenerateEntryName(const Data::CreditsHistoryEntry &entry) {
|
||||
return ((entry.peerType == Data::CreditsHistoryEntry::PeerType::Fragment)
|
||||
return (entry.gift
|
||||
? tr::lng_credits_box_history_entry_gift_name
|
||||
: (entry.peerType == Data::CreditsHistoryEntry::PeerType::Fragment)
|
||||
? tr::lng_bot_username_description1_link
|
||||
: (entry.peerType == Data::CreditsHistoryEntry::PeerType::PremiumBot)
|
||||
? tr::lng_credits_box_history_entry_premium_bot
|
||||
|
|
Loading…
Add table
Reference in a new issue