From ef3acb8c430f88664dbc3895e666e76836ad163d Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Mon, 27 Jun 2022 18:04:14 +0600 Subject: [PATCH] Sort Manga by title in `MigrationMangaScreeen` (#7392) --- .../ui/browse/migration/manga/MigrationMangaPresenter.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaPresenter.kt index 9517924727..cc8dd804ef 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaPresenter.kt @@ -10,6 +10,7 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.flow.map import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -29,8 +30,11 @@ class MigrationMangaPresenter( .catch { exception -> _state.value = MigrateMangaState.Error(exception) } - .collectLatest { list -> - _state.value = MigrateMangaState.Success(list) + .map { list -> + list.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.title }) + } + .collectLatest { sortedList -> + _state.value = MigrateMangaState.Success(sortedList) } } }