mirror of
https://github.com/yattee/yattee.git
synced 2025-11-22 06:31:26 +00:00
Add feature flag to disable Trending functionality
Introduces a feature flag to disable the Trending section across the app. When disabled, all trending-related UI elements, navigation links, and settings are hidden. Changes: - Add trendingEnabled feature flag to FeatureFlags.swift (currently disabled) - Hide Trending tab in AppTabNavigation, Sidebar, and TVNavigationView - Remove Trending option from visible sections settings - Remove Trending option from startup section picker - Disable Trending menu command and keyboard shortcut - Prevent Trending URL navigation in OpenURLHandler - Hide Trending in FavoriteItemView navigation
This commit is contained in:
@@ -5,4 +5,8 @@ enum FeatureFlags {
|
||||
/// Controls whether the "Hide Shorts" functionality is available
|
||||
/// Set to false when the API changes prevent reliable detection of short videos
|
||||
static let hideShortsEnabled = false
|
||||
|
||||
/// Controls whether the "Trending" section is available
|
||||
/// Set to false to disable trending functionality across the app
|
||||
static let trendingEnabled = false
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ struct FavoriteItemView: View {
|
||||
case .history:
|
||||
return false
|
||||
case .trending:
|
||||
return visibleSections.contains(.trending)
|
||||
return FeatureFlags.trendingEnabled && visibleSections.contains(.trending)
|
||||
case .subscriptions:
|
||||
return visibleSections.contains(.subscriptions) && accounts.signedIn
|
||||
case .popular:
|
||||
|
||||
@@ -39,6 +39,7 @@ struct MenuCommands: Commands {
|
||||
Button("Trending") {
|
||||
setTabSelection(.trending)
|
||||
}
|
||||
.disabled(!FeatureFlags.trendingEnabled)
|
||||
.keyboardShortcut("4")
|
||||
|
||||
Button("Search") {
|
||||
|
||||
@@ -37,7 +37,7 @@ struct AppTabNavigation: View {
|
||||
popularNavigationView
|
||||
}
|
||||
|
||||
if visibleSections.contains(.trending) {
|
||||
if FeatureFlags.trendingEnabled && visibleSections.contains(.trending) {
|
||||
trendingNavigationView
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ struct Sidebar: View {
|
||||
.id("popular")
|
||||
}
|
||||
|
||||
if visibleSections.contains(.trending) {
|
||||
if FeatureFlags.trendingEnabled && visibleSections.contains(.trending) {
|
||||
NavigationLink(destination: LazyView(TrendingView()), tag: TabSelection.trending, selection: $navigation.tabSelection) {
|
||||
Label("Trending", systemImage: "arrow.up.right.circle.fill")
|
||||
.accessibility(label: Text("Trending"))
|
||||
|
||||
@@ -74,6 +74,7 @@ struct OpenURLHandler {
|
||||
focusMainWindow()
|
||||
#endif
|
||||
case .trending:
|
||||
guard FeatureFlags.trendingEnabled else { return }
|
||||
navigation.hideViewsAboveBrowser()
|
||||
navigation.tabSelection = .trending
|
||||
#if os(macOS)
|
||||
|
||||
@@ -258,11 +258,13 @@ struct BrowsingSettings: View {
|
||||
private var visibleSectionsSettings: some View {
|
||||
Section(header: SettingsHeader(text: "Sections".localized())) {
|
||||
ForEach(VisibleSection.allCases, id: \.self) { section in
|
||||
MultiselectRow(
|
||||
title: section.title,
|
||||
selected: visibleSections.contains(section)
|
||||
) { value in
|
||||
toggleSection(section, value: value)
|
||||
if section != .trending || FeatureFlags.trendingEnabled {
|
||||
MultiselectRow(
|
||||
title: section.title,
|
||||
selected: visibleSections.contains(section)
|
||||
) { value in
|
||||
toggleSection(section, value: value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,7 +281,9 @@ struct BrowsingSettings: View {
|
||||
Spacer()
|
||||
Picker("Startup section", selection: $startupSection) {
|
||||
ForEach(StartupSection.allCases, id: \.rawValue) { section in
|
||||
Text(section.label).tag(section)
|
||||
if section != .trending || FeatureFlags.trendingEnabled {
|
||||
Text(section.label).tag(section)
|
||||
}
|
||||
}
|
||||
}
|
||||
.modifier(SettingsPickerModifier())
|
||||
@@ -287,7 +291,9 @@ struct BrowsingSettings: View {
|
||||
#else
|
||||
Picker("Startup section", selection: $startupSection) {
|
||||
ForEach(StartupSection.allCases, id: \.rawValue) { section in
|
||||
Text(section.label).tag(section)
|
||||
if section != .trending || FeatureFlags.trendingEnabled {
|
||||
Text(section.label).tag(section)
|
||||
}
|
||||
}
|
||||
}
|
||||
.modifier(SettingsPickerModifier())
|
||||
|
||||
Reference in New Issue
Block a user