Minor cleanup

This commit is contained in:
arkon
2023-12-03 15:56:51 -05:00
parent 0c860c0fe9
commit 427fbfdf5e
2 changed files with 14 additions and 10 deletions

View File

@@ -88,7 +88,6 @@ import tachiyomi.core.util.lang.launchIO
import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
@@ -183,7 +182,7 @@ class ReaderActivity : BaseActivity() {
.map { it.manga }
.distinctUntilChanged()
.filterNotNull()
.onEach(::setManga)
.onEach { updateViewer() }
.launchIn(lifecycleScope)
viewModel.state
@@ -486,10 +485,9 @@ class ReaderActivity : BaseActivity() {
}
/**
* Called from the presenter when a manga is ready. Used to instantiate the appropriate viewer
* and the toolbar title.
* Called from the presenter when a manga is ready. Used to instantiate the appropriate viewer.
*/
private fun setManga(manga: Manga) {
private fun updateViewer() {
val prevViewer = viewModel.state.value.viewer
val newViewer = ReadingMode.toViewer(viewModel.getMangaReadingMode(), this)