Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hide Feed tab toggle #1058

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class UiPreferences(

fun expandFilters() = preferenceStore.getBoolean("eh_expand_filters", false)

fun hideFeedTab() = preferenceStore.getBoolean("hide_latest_tab", false)

fun feedTabInFront() = preferenceStore.getBoolean("latest_tab_position", false)

fun recommendsInOverflow() = preferenceStore.getBoolean("recommends_in_overflow", false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.platform.LocalContext
import androidx.fragment.app.FragmentActivity
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.core.preference.asState
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.domain.ui.UiPreferences
import eu.kanade.presentation.more.settings.Preference
Expand Down Expand Up @@ -40,6 +42,8 @@ object SettingsBrowseScreen : SearchableSettings {
val reposCount by sourcePreferences.extensionRepos().collectAsState()

// SY -->
val scope = rememberCoroutineScope()
val hideFeedTab by remember { Injekt.get<UiPreferences>().hideFeedTab().asState(scope) }
val uiPreferences = remember { Injekt.get<UiPreferences>() }
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() }
// SY <--
Expand Down Expand Up @@ -78,10 +82,15 @@ object SettingsBrowseScreen : SearchableSettings {
Preference.PreferenceGroup(
title = stringResource(SYMR.strings.feed),
preferenceItems = persistentListOf(
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.hideFeedTab(),
title = stringResource(SYMR.strings.pref_hide_feed),
),
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.feedTabInFront(),
title = stringResource(SYMR.strings.pref_feed_position),
subtitle = stringResource(SYMR.strings.pref_feed_position_summery),
enabled = hideFeedTab.not()
),
),
),
Expand Down
13 changes: 9 additions & 4 deletions app/src/main/java/eu/kanade/tachiyomi/ui/browse/BrowseTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ data class BrowseTab(
val context = LocalContext.current
val scope = rememberCoroutineScope()
// SY -->
val feedTabInFront by remember {
Injekt.get<UiPreferences>().feedTabInFront().asState(scope)
}
val hideFeedTab by remember { Injekt.get<UiPreferences>().hideFeedTab().asState(scope) }
val feedTabInFront by remember { Injekt.get<UiPreferences>().feedTabInFront().asState(scope) }
// SY <--

// Hoisted for extensions tab's search bar
Expand All @@ -69,7 +68,13 @@ data class BrowseTab(
TabbedScreen(
titleRes = MR.strings.browse,
// SY -->
tabs = if (feedTabInFront) {
tabs = if (hideFeedTab) {
persistentListOf(
sourcesTab(),
extensionsTab(extensionsScreenModel),
migrateSourceTab(),
)
} else if (feedTabInFront) {
persistentListOf(
feedTab(),
sourcesTab(),
Expand Down
1 change: 1 addition & 0 deletions i18n-sy/src/commonMain/resources/MR/base/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
<string name="library_group_updates_all">Launch category updates all the time</string>

<!-- Browse settings -->
<string name="pref_hide_feed">Hide Feed tab</string>
<string name="pref_feed_position">Feed tab position</string>
<string name="pref_feed_position_summery">Do you want the feed tab to be the first tab in browse? This will make it the default tab when opening browse, not recommended if you\'re on data or a metered network</string>
<string name="pref_source_source_filtering">Filter sources in categories</string>
Expand Down
Loading