Skip to content

Commit 641310f

Browse files
committed
Various fixes
1 parent 2fc5a19 commit 641310f

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

submodules/TelegramUI/Components/Gifts/GiftStoreScreen/Sources/GiftStoreScreen.swift

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,13 @@ final class GiftStoreScreenComponent: Component {
519519
} else {
520520
return false
521521
}
522-
}
522+
}.sorted(by: { lhs, rhs in
523+
if case let .model(_, lhsFile, _) = lhs, case let .model(_, rhsFile, _) = rhs, let lhsCount = self.state?.starGiftsState?.attributeCount[.model(lhsFile.fileId.id)], let rhsCount = self.state?.starGiftsState?.attributeCount[.model(rhsFile.fileId.id)] {
524+
return lhsCount > rhsCount
525+
} else {
526+
return false
527+
}
528+
})
523529

524530
let currentFilterAttributes = self.state?.starGiftsState?.filterAttributes ?? []
525531
let selectedModelAttributes = currentFilterAttributes.filter { attribute in
@@ -614,7 +620,13 @@ final class GiftStoreScreenComponent: Component {
614620
} else {
615621
return false
616622
}
617-
}
623+
}.sorted(by: { lhs, rhs in
624+
if case let .backdrop(_, lhsId, _, _, _, _, _) = lhs, case let .backdrop(_, rhsId, _, _, _, _, _) = rhs, let lhsCount = self.state?.starGiftsState?.attributeCount[.backdrop(lhsId)], let rhsCount = self.state?.starGiftsState?.attributeCount[.backdrop(rhsId)] {
625+
return lhsCount > rhsCount
626+
} else {
627+
return false
628+
}
629+
})
618630

619631
let currentFilterAttributes = self.state?.starGiftsState?.filterAttributes ?? []
620632
let selectedBackdropAttributes = currentFilterAttributes.filter { attribute in
@@ -709,7 +721,13 @@ final class GiftStoreScreenComponent: Component {
709721
} else {
710722
return false
711723
}
712-
}
724+
}.sorted(by: { lhs, rhs in
725+
if case let .pattern(_, lhsFile, _) = lhs, case let .pattern(_, rhsFile, _) = rhs, let lhsCount = self.state?.starGiftsState?.attributeCount[.pattern(lhsFile.fileId.id)], let rhsCount = self.state?.starGiftsState?.attributeCount[.pattern(rhsFile.fileId.id)] {
726+
return lhsCount > rhsCount
727+
} else {
728+
return false
729+
}
730+
})
713731

714732
let currentFilterAttributes = self.state?.starGiftsState?.filterAttributes ?? []
715733
let selectedPatternAttributes = currentFilterAttributes.filter { attribute in

0 commit comments

Comments
 (0)