From 5c9e9bd2c4647da189d7313f2ee206541e65f409 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 26 Nov 2022 09:34:06 -0500 Subject: [PATCH] Use Voyager between more screens --- .../more/settings/screen/SettingsLibraryScreen.kt | 13 ++++++------- .../eu/kanade/tachiyomi/ui/manga/MangaScreen.kt | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt index 5ee9637b9..52ef871dc 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt @@ -32,8 +32,9 @@ import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastMap import androidx.core.content.ContextCompat +import cafe.adriel.voyager.navigator.LocalNavigator +import cafe.adriel.voyager.navigator.Navigator import cafe.adriel.voyager.navigator.currentOrThrow -import com.bluelinelabs.conductor.Router import com.commandiron.wheel_picker_compose.WheelPicker import eu.kanade.domain.category.interactor.GetCategories import eu.kanade.domain.category.interactor.ResetCategoryFlags @@ -42,7 +43,6 @@ import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.presentation.category.visualName import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.more.settings.widget.TriStateListDialog -import eu.kanade.presentation.util.LocalRouter import eu.kanade.presentation.util.collectAsState import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.library.LibraryUpdateJob @@ -54,8 +54,7 @@ import eu.kanade.tachiyomi.data.preference.MANGA_HAS_UNREAD import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED import eu.kanade.tachiyomi.data.preference.MANGA_NON_READ import eu.kanade.tachiyomi.data.track.TrackManager -import eu.kanade.tachiyomi.ui.base.controller.pushController -import eu.kanade.tachiyomi.ui.category.CategoryController +import eu.kanade.tachiyomi.ui.category.CategoryScreen import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import uy.kohesive.injekt.Injekt @@ -76,7 +75,7 @@ object SettingsLibraryScreen : SearchableSettings { return mutableListOf( getDisplayGroup(libraryPreferences), - getCategoriesGroup(LocalRouter.currentOrThrow, allCategories, libraryPreferences), + getCategoriesGroup(LocalNavigator.currentOrThrow, allCategories, libraryPreferences), getGlobalUpdateGroup(allCategories, libraryPreferences), ) } @@ -116,7 +115,7 @@ object SettingsLibraryScreen : SearchableSettings { @Composable private fun getCategoriesGroup( - router: Router?, + navigator: Navigator, allCategories: List, libraryPreferences: LibraryPreferences, ): Preference.PreferenceGroup { @@ -143,7 +142,7 @@ object SettingsLibraryScreen : SearchableSettings { count = userCategoriesCount, userCategoriesCount, ), - onClick = { router?.pushController(CategoryController()) }, + onClick = { navigator.push(CategoryScreen()) }, ), Preference.PreferenceItem.ListPreference( pref = libraryPreferences.defaultCategory(), diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt index 7bab376d2..05ae69352 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt @@ -53,7 +53,7 @@ import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.browse.migration.search.SearchController import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController -import eu.kanade.tachiyomi.ui.category.CategoryController +import eu.kanade.tachiyomi.ui.category.CategoryScreen import eu.kanade.tachiyomi.ui.history.HistoryController import eu.kanade.tachiyomi.ui.library.LibraryController import eu.kanade.tachiyomi.ui.main.MainActivity @@ -130,7 +130,7 @@ class MangaScreen( ChangeCategoryDialog( initialSelection = dialog.initialSelection, onDismissRequest = onDismissRequest, - onEditCategories = { router.pushController(CategoryController()) }, + onEditCategories = { navigator.push(CategoryScreen()) }, onConfirm = { include, _ -> screenModel.moveMangaToCategoriesAndAddToLibrary(dialog.manga, include) },