More fixing to the sort by tags logic

This commit is contained in:
Jobobby04 2020-09-16 12:58:25 -04:00
parent 905e1b68c6
commit 67c99c9c42

View File

@ -313,7 +313,14 @@ class LibraryPresenter(
// SY -->
val listOfTags by lazy {
preferences.sortTagsForLibrary().get().toList().mapNotNull { it.split("|").getOrNull(1) }.map { ("(, |^)$it").toRegex(RegexOption.IGNORE_CASE) }
preferences.sortTagsForLibrary().get().toList()
.mapNotNull {
val list = it.split("|")
(list.getOrNull(0)?.toIntOrNull() ?: return@mapNotNull null) to (list.getOrNull(1) ?: return@mapNotNull null)
}
.sortedBy { it.first }
.map { it.second }
.map { ("(, |^)$it").toRegex(RegexOption.IGNORE_CASE) }
}
// SY <--