mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 11:17:25 +01:00
parent
47f14e8555
commit
8ebda219c4
@ -413,12 +413,10 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
|||||||
activity?.toast(activity?.getString(R.string.manga_added_library))
|
activity?.toast(activity?.getString(R.string.manga_added_library))
|
||||||
}
|
}
|
||||||
val categories = presenter.getCategories()
|
val categories = presenter.getCategories()
|
||||||
val defaultCategory = categories.find { it.id == preferences.defaultCategory() }
|
if (categories.size <= 1) {
|
||||||
when {
|
// default or the one from the user then just add to favorite.
|
||||||
defaultCategory != null -> presenter.moveMangaToCategory(manga, defaultCategory)
|
|
||||||
categories.size <= 1 -> // default or the one from the user
|
|
||||||
presenter.moveMangaToCategory(manga, categories.firstOrNull())
|
presenter.moveMangaToCategory(manga, categories.firstOrNull())
|
||||||
else -> {
|
} else {
|
||||||
val ids = presenter.getMangaCategoryIds(manga)
|
val ids = presenter.getMangaCategoryIds(manga)
|
||||||
val preselected = ids.mapNotNull { id ->
|
val preselected = ids.mapNotNull { id ->
|
||||||
categories.indexOfFirst { it.id == id }.takeIf { it != -1 }
|
categories.indexOfFirst { it.id == id }.takeIf { it != -1 }
|
||||||
@ -428,7 +426,6 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
|||||||
.showDialog(router)
|
.showDialog(router)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateCategoriesForMangas(mangas: List<Manga>, categories: List<Category>) {
|
override fun updateCategoriesForMangas(mangas: List<Manga>, categories: List<Category>) {
|
||||||
val manga = mangas.firstOrNull() ?: return
|
val manga = mangas.firstOrNull() ?: return
|
||||||
|
Loading…
Reference in New Issue
Block a user