Update app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt

Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
Jack Hamilton 2024-10-11 21:07:17 -05:00 committed by GitHub
parent 2eb1580788
commit 078758391e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -305,16 +305,15 @@ class LibraryScreenModel(
}
return mapValues { (key, value) ->
when (key.sort.type) {
LibrarySort.Type.Random -> value.shuffled(Random(libraryPreferences.currentRandomSortSeed().get()))
else -> {
val comparator = key.sort.comparator()
.let { if (key.sort.isAscending) it else it.reversed() }
.thenComparator(sortAlphabetically)
if (key.sort.type == LibrarySort.Type.Random) {
return@mapValues value.shuffled(Random(libraryPreferences.currentRandomSortSeed().get()))
}
value.sortedWith(comparator)
}
}
val comparator = key.sort.comparator()
.let { if (key.sort.isAscending) it else it.reversed() }
.thenComparator(sortAlphabetically)
value.sortedWith(comparator)
}
}