From 8ad933786377f761bd90d3f8d93d646a213a3f25 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Tue, 29 Nov 2022 20:06:52 +0600 Subject: [PATCH] Fix Stub Source migration screen broken (#8643) * Fix Stub Source migration screen broken * Lint --- .../migration/manga/MigrationMangaScreen.kt | 4 ---- .../migration/manga/MigrationMangaScreenModel.kt | 15 ++++++--------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreen.kt index 098c0d2b8f..948987e210 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreen.kt @@ -50,10 +50,6 @@ data class MigrationMangaScreen( MigrationMangaEvent.FailedFetchingFavorites -> { context.toast(R.string.internal_error) } - MigrationMangaEvent.FailedGettingSource -> { - context.toast(R.string.loader_not_implemented_error) - router.popCurrentController() - } } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreenModel.kt index 1abba3d3a6..116645a421 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreenModel.kt @@ -32,21 +32,19 @@ class MigrationMangaScreenModel( init { coroutineScope.launch { mutableState.update { state -> - val source = sourceManager.get(sourceId) - if (source == null) { - _events.send(MigrationMangaEvent.FailedGettingSource) - } - state.copy(source = source) + state.copy(source = sourceManager.getOrStub(sourceId)) } getFavorites.subscribe(sourceId) .catch { logcat(LogPriority.ERROR, it) _events.send(MigrationMangaEvent.FailedFetchingFavorites) - mutableState.update { it.copy(titleList = emptyList()) } + mutableState.update { state -> + state.copy(titleList = emptyList()) + } } - .map { - it.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.title }) + .map { manga -> + manga.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.title }) } .collectLatest { list -> mutableState.update { it.copy(titleList = list) } @@ -56,7 +54,6 @@ class MigrationMangaScreenModel( } sealed class MigrationMangaEvent { - object FailedGettingSource : MigrationMangaEvent() object FailedFetchingFavorites : MigrationMangaEvent() }