mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Improved sort of received star gifts.
This commit is contained in:
@@ -681,6 +681,21 @@ 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;
|
||||
});
|
||||
|
||||
auto &map = Map[session];
|
||||
if (map.last != list) {
|
||||
map.last = list;
|
||||
|
||||
Reference in New Issue
Block a user