mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Fix Stub Source migration screen broken (#8643)
* Fix Stub Source migration screen broken * Lint
This commit is contained in:
parent
cd13e187cf
commit
8ad9337863
2 changed files with 6 additions and 13 deletions
|
@ -50,10 +50,6 @@ data class MigrationMangaScreen(
|
||||||
MigrationMangaEvent.FailedFetchingFavorites -> {
|
MigrationMangaEvent.FailedFetchingFavorites -> {
|
||||||
context.toast(R.string.internal_error)
|
context.toast(R.string.internal_error)
|
||||||
}
|
}
|
||||||
MigrationMangaEvent.FailedGettingSource -> {
|
|
||||||
context.toast(R.string.loader_not_implemented_error)
|
|
||||||
router.popCurrentController()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,21 +32,19 @@ class MigrationMangaScreenModel(
|
||||||
init {
|
init {
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
mutableState.update { state ->
|
mutableState.update { state ->
|
||||||
val source = sourceManager.get(sourceId)
|
state.copy(source = sourceManager.getOrStub(sourceId))
|
||||||
if (source == null) {
|
|
||||||
_events.send(MigrationMangaEvent.FailedGettingSource)
|
|
||||||
}
|
|
||||||
state.copy(source = source)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getFavorites.subscribe(sourceId)
|
getFavorites.subscribe(sourceId)
|
||||||
.catch {
|
.catch {
|
||||||
logcat(LogPriority.ERROR, it)
|
logcat(LogPriority.ERROR, it)
|
||||||
_events.send(MigrationMangaEvent.FailedFetchingFavorites)
|
_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 ->
|
.collectLatest { list ->
|
||||||
mutableState.update { it.copy(titleList = list) }
|
mutableState.update { it.copy(titleList = list) }
|
||||||
|
@ -56,7 +54,6 @@ class MigrationMangaScreenModel(
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class MigrationMangaEvent {
|
sealed class MigrationMangaEvent {
|
||||||
object FailedGettingSource : MigrationMangaEvent()
|
|
||||||
object FailedFetchingFavorites : MigrationMangaEvent()
|
object FailedFetchingFavorites : MigrationMangaEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue