mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-03 21:54:05 +02:00
Fixed sort of received star gifts.
This commit is contained in:
parent
fe0c1acd79
commit
0d346610a2
3 changed files with 4 additions and 13 deletions
|
@ -816,6 +816,7 @@ std::optional<Data::StarGift> FromTL(
|
|||
.lastSaleDate = data.vlast_sale_date().value_or_empty(),
|
||||
.upgradable = data.vupgrade_stars().has_value(),
|
||||
.birthday = data.is_birthday(),
|
||||
.soldOut = data.is_sold_out(),
|
||||
});
|
||||
}, [&](const MTPDstarGiftUnique &data) {
|
||||
const auto total = data.vavailability_total().v;
|
||||
|
|
|
@ -718,19 +718,8 @@ void PreviewWrap::paintEvent(QPaintEvent *e) {
|
|||
for (auto &gift : gifts) {
|
||||
list.push_back({ .info = gift });
|
||||
}
|
||||
ranges::sort(list, [](
|
||||
const GiftTypeStars &a,
|
||||
const GiftTypeStars &b) {
|
||||
if (!a.info.limitedCount && !b.info.limitedCount) {
|
||||
return a.info.stars <= b.info.stars;
|
||||
} else if (!a.info.limitedCount) {
|
||||
return true;
|
||||
} else if (!b.info.limitedCount) {
|
||||
return false;
|
||||
} else if (a.info.limitedLeft != b.info.limitedLeft) {
|
||||
return a.info.limitedLeft > b.info.limitedLeft;
|
||||
}
|
||||
return a.info.stars <= b.info.stars;
|
||||
ranges::stable_sort(list, [](const auto &a, const auto &b) {
|
||||
return a.info.soldOut < b.info.soldOut;
|
||||
});
|
||||
|
||||
auto &map = Map[session];
|
||||
|
|
|
@ -69,6 +69,7 @@ struct StarGift {
|
|||
TimeId lastSaleDate = 0;
|
||||
bool upgradable = false;
|
||||
bool birthday = false;
|
||||
bool soldOut = false;
|
||||
|
||||
friend inline bool operator==(
|
||||
const StarGift &,
|
||||
|
|
Loading…
Add table
Reference in a new issue