2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-22 02:07:24 +00:00

Improve posts search transaction entry view.

This commit is contained in:
John Preston 2025-08-05 10:43:10 +04:00
parent 5473696491
commit bf0b85afd1
9 changed files with 27 additions and 13 deletions

View File

@ -2902,6 +2902,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_credits_box_history_entry_ads" = "Ads Platform";
"lng_credits_box_history_entry_premium_bot" = "Stars Top-Up";
"lng_credits_box_history_entry_currency_in" = "TON Top-Up";
"lng_credits_box_history_entry_posts_search" = "Posts Search";
"lng_credits_box_history_entry_api" = "Paid Broadcast";
"lng_credits_box_history_entry_floodskip_about#one" = "{count} Message";
"lng_credits_box_history_entry_floodskip_about#other" = "{count} Messages";

View File

@ -153,6 +153,7 @@ Data::CreditsHistoryEntry CreditsHistoryEntryFromTL(
.floodSkip = int(tl.data().vfloodskip_number().value_or(0)),
.converted = stargift && incoming,
.stargift = stargift.has_value(),
.postsSearch = tl.data().is_posts_search(),
.giftUpgraded = tl.data().is_stargift_upgrade(),
.giftResale = tl.data().is_stargift_resale(),
.reaction = tl.data().is_reaction(),

View File

@ -1674,7 +1674,8 @@ void AddCreditsHistoryEntryTable(
show,
peerId);
}
if (actorId || (!entry.starrefCommission && peerId)) {
if (!entry.postsSearch
&& (actorId || (!entry.starrefCommission && peerId))) {
auto text = entry.starrefCommission
? tr::lng_credits_box_history_entry_referred()
: entry.in

View File

@ -98,6 +98,7 @@ struct CreditsHistoryEntry final {
bool converted : 1 = false;
bool anonymous : 1 = false;
bool stargift : 1 = false;
bool postsSearch : 1 = false;
bool giftTransferred : 1 = false;
bool giftRefunded : 1 = false;
bool giftUpgraded : 1 = false;

View File

@ -868,7 +868,6 @@ postsSearchIntroFooter: FlatLabel(defaultFlatLabel) {
}
}
postsSearchIntroFooterMargin: margins(20px, 12px, 20px, 0px);
postsSearchIcon: icon {{ "box_search", windowFgActive }};
postsSearchIconPadding: margins(12px, 1px, 6px, 0px);
postsSearchArrow: icon {{ "dialogs/mini_arrow", windowFgActive }};

View File

@ -887,6 +887,8 @@ void CreditsRow::init() {
tr::now,
lt_count,
_entry.paidMessagesCount)
: _entry.postsSearch
? tr::lng_credits_box_history_entry_posts_search(tr::now)
: ((!_entry.subscriptionUntil.isNull() && !isSpecial)
|| (_entry.giftUpgraded && !isSpecial)
|| (_entry.giftResale && !isSpecial)
@ -997,14 +999,9 @@ void CreditsRow::init() {
}
}
if (!_paintUserpicCallback) {
_paintUserpicCallback = /*_entry.stargift
? Ui::GenerateGiftStickerUserpicCallback(
_session,
_entry.bareGiftStickerId,
_context.repaint)
: */!isSpecial
? PeerListRow::generatePaintUserpicCallback(false)
: Ui::GenerateCreditsPaintUserpicCallback(_entry);
_paintUserpicCallback = (isSpecial || _entry.postsSearch)
? Ui::GenerateCreditsPaintUserpicCallback(_entry)
: PeerListRow::generatePaintUserpicCallback(false);
}
}

View File

@ -1282,7 +1282,10 @@ void GenericCreditsEntryBox(
content->add(object_ptr<Ui::CenterWrap<>>(
content,
GenericEntryPhoto(content, callback, stUser.photoSize)));
} else if (peer && !e.gift && !e.premiumMonthsForStars) {
} else if (peer
&& !e.gift
&& !e.premiumMonthsForStars
&& !e.postsSearch) {
if (e.subscriptionUntil.isNull() && s.until.isNull()) {
content->add(object_ptr<Ui::CenterWrap<>>(
content,
@ -1368,7 +1371,7 @@ void GenericCreditsEntryBox(
? st::creditsHistoryEntryStarGiftSkip
: st::creditsHistoryEntryGiftStickerSkip);
}, icon->lifetime());
} else {
} else if (!e.postsSearch) {
const auto widget = content->add(
object_ptr<Ui::CenterWrap<>>(
content,
@ -1405,6 +1408,8 @@ void GenericCreditsEntryBox(
tr::now,
lt_count,
e.paidMessagesCount)
: e.postsSearch
? tr::lng_credits_box_history_entry_posts_search(tr::now)
: e.premiumMonthsForStars
? tr::lng_premium_summary_title(tr::now)
: !e.title.isEmpty()

View File

@ -99,6 +99,7 @@ tonIconEmojiInSmall: IconEmoji(tonIconEmoji) {
}
creditsHistoryEntryTypeAds: icon {{ "folders/folders_channels", premiumButtonFg }};
creditsHistorySearchPostsIcon: icon {{ "box_search", historyPeerUserpicFg }};
creditsHistoryEntryGiftStickerSkip: -20px;
creditsHistoryEntryGiftStickerSize: 150px;

View File

@ -223,6 +223,12 @@ PaintRoundImageCallback GenerateCreditsPaintUserpicCallback(
};
}
const auto bg = [&]() -> EmptyUserpic::BgColors {
if (entry.postsSearch) {
return {
st::historyPeerSavedMessagesBg,
st::historyPeerSavedMessagesBg2,
};
}
switch (entry.peerType) {
case Data::CreditsHistoryEntry::PeerType::API:
return { st::historyPeer2UserpicBg, st::historyPeer2UserpicBg2 };
@ -306,7 +312,9 @@ PaintRoundImageCallback GenerateCreditsPaintUserpicCallback(
return [=](Painter &p, int x, int y, int outerWidth, int size) mutable {
userpic->paintCircle(p, x, y, outerWidth, size);
const auto rect = QRect(x, y, size, size);
((entry.peerType == PeerType::AppStore)
(entry.postsSearch
? st::creditsHistorySearchPostsIcon
: (entry.peerType == PeerType::AppStore)
? st::sessionIconiPhone
: (entry.peerType == PeerType::PlayMarket)
? st::sessionIconAndroid