diff --git a/Shared/FeatureFlags.swift b/Shared/FeatureFlags.swift index 8ab9f231..f7b483e0 100644 --- a/Shared/FeatureFlags.swift +++ b/Shared/FeatureFlags.swift @@ -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 } diff --git a/Shared/Home/FavoriteItemView.swift b/Shared/Home/FavoriteItemView.swift index 4a17b8a0..9dc0bf1d 100644 --- a/Shared/Home/FavoriteItemView.swift +++ b/Shared/Home/FavoriteItemView.swift @@ -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: diff --git a/Shared/MenuCommands.swift b/Shared/MenuCommands.swift index b66f5051..73285416 100644 --- a/Shared/MenuCommands.swift +++ b/Shared/MenuCommands.swift @@ -39,6 +39,7 @@ struct MenuCommands: Commands { Button("Trending") { setTabSelection(.trending) } + .disabled(!FeatureFlags.trendingEnabled) .keyboardShortcut("4") Button("Search") { diff --git a/Shared/Navigation/AppTabNavigation.swift b/Shared/Navigation/AppTabNavigation.swift index 3f443469..0f445225 100644 --- a/Shared/Navigation/AppTabNavigation.swift +++ b/Shared/Navigation/AppTabNavigation.swift @@ -37,7 +37,7 @@ struct AppTabNavigation: View { popularNavigationView } - if visibleSections.contains(.trending) { + if FeatureFlags.trendingEnabled && visibleSections.contains(.trending) { trendingNavigationView } diff --git a/Shared/Navigation/Sidebar.swift b/Shared/Navigation/Sidebar.swift index aeb930b4..518a2b95 100644 --- a/Shared/Navigation/Sidebar.swift +++ b/Shared/Navigation/Sidebar.swift @@ -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")) diff --git a/Shared/OpenURLHandler.swift b/Shared/OpenURLHandler.swift index 12c69eff..1c9a6a85 100644 --- a/Shared/OpenURLHandler.swift +++ b/Shared/OpenURLHandler.swift @@ -74,6 +74,7 @@ struct OpenURLHandler { focusMainWindow() #endif case .trending: + guard FeatureFlags.trendingEnabled else { return } navigation.hideViewsAboveBrowser() navigation.tabSelection = .trending #if os(macOS) diff --git a/Shared/Settings/BrowsingSettings.swift b/Shared/Settings/BrowsingSettings.swift index 102982e1..04fb374f 100644 --- a/Shared/Settings/BrowsingSettings.swift +++ b/Shared/Settings/BrowsingSettings.swift @@ -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()) diff --git a/tvOS/TVNavigationView.swift b/tvOS/TVNavigationView.swift index 02f91d89..f59f79d5 100644 --- a/tvOS/TVNavigationView.swift +++ b/tvOS/TVNavigationView.swift @@ -29,7 +29,7 @@ struct TVNavigationView: View { .tag(TabSelection.popular) } - if visibleSections.contains(.trending) { + if FeatureFlags.trendingEnabled && visibleSections.contains(.trending) { LazyView(TrendingView()) .tabItem { Text("Trending") } .tag(TabSelection.trending)