Use Non-H as default category for guest mode

Don't modify the URL builder.
This commit is contained in:
FooIbar committed 2024-05-30 10:57:26 +08:00
1 parent a81eb9d17b
commit b27d214f24
2 files changed
+2 -4

No files matched your search

@@ -262,6 +262,7 @@ data class ListUrlBuilder(
fun build(): String {
return when (mode) {
MODE_NORMAL, MODE_SUBSCRIPTION -> ehUrl(EhUrl.WATCHED_PATH.takeIf { mode == MODE_SUBSCRIPTION }) {
val category = if (!Settings.hasSignedIn.value && category <= 0) EhUtils.NON_H else category
if (category > 0) {
addQueryParameter("f_cats", (category.inv() and EhUtils.ALL_CATEGORY).toString())
}
@@ -153,10 +153,7 @@ import sh.calvin.reorderable.rememberReorderableLazyListState
@Destination<RootGraph>
@Composable
fun HomePageScreen(navigator: DestinationsNavigator) {
val hasSignedIn by Settings.hasSignedIn.collectAsState()
GalleryListScreen(ListUrlBuilder(category = if (hasSignedIn) EhUtils.NONE else EhUtils.NON_H), navigator)
}
fun HomePageScreen(navigator: DestinationsNavigator) = GalleryListScreen(ListUrlBuilder(), navigator)
@Destination<RootGraph>
@Composable