From da20e565cda0871f693fef5485431b4bb1618e81 Mon Sep 17 00:00:00 2001 From: ILoveOpenSourceApplications <117499019+ILoveOpenSourceApplications@users.noreply.github.com> Date: Fri, 27 Jun 2025 17:03:53 +0530 Subject: [PATCH] feat(YouTube - Hide layout components): Add `Hide in history` option to filter bar (#5271) --- .../patches/components/LayoutComponentsFilter.java | 13 ++++++++++++- .../extension/youtube/settings/Settings.java | 1 + .../hide/general/HideLayoutComponentsPatch.kt | 1 + .../main/resources/addresources/values/strings.xml | 11 +++++++---- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java index 347491a46..30244b361 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java @@ -39,6 +39,7 @@ public final class LayoutComponentsFilter extends Filter { private final ByteArrayFilterGroup joinMembershipButton; private final StringFilterGroup horizontalShelves; private final ByteArrayFilterGroup ticketShelf; + private final StringFilterGroup chipBar; public LayoutComponentsFilter() { exceptions.addPatterns( @@ -105,6 +106,11 @@ public final class LayoutComponentsFilter extends Filter { "subscriptions_chip_bar" ); + chipBar = new StringFilterGroup( + Settings.HIDE_FILTER_BAR_FEED_IN_HISTORY, + "chip_bar" + ); + inFeedSurvey = new StringFilterGroup( Settings.HIDE_FEED_SURVEY, "in_feed_survey", @@ -272,6 +278,7 @@ public final class LayoutComponentsFilter extends Filter { emergencyBox, subscribersCommunityGuidelines, subscriptionsChipBar, + chipBar, channelGuidelines, audioTrackButton, artistCard, @@ -314,6 +321,10 @@ public final class LayoutComponentsFilter extends Filter { return contentIndex == 0 && (hideShelves() || ticketShelf.check(protobufBufferArray).isFiltered()); } + if (matchedGroup == chipBar) { + return contentIndex == 0 && NavigationButton.getSelectedNavigationButton() == NavigationButton.LIBRARY; + } + return true; } @@ -448,7 +459,7 @@ public final class LayoutComponentsFilter extends Filter { } // Do not hide if the navigation back button is visible, - // otherwise the content shelves in the explore/music/courses pages are hidde. + // otherwise the content shelves in the explore/music/courses pages are hidden. if (NavigationBar.isBackButtonVisible()) { return false; } diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java index 8f6e080b0..cdf86fd75 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java @@ -98,6 +98,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_EXPANDABLE_CHIP = new BooleanSetting("revanced_hide_expandable_chip", TRUE); public static final BooleanSetting HIDE_FEED_SURVEY = new BooleanSetting("revanced_hide_feed_survey", TRUE); public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_FEED = new BooleanSetting("revanced_hide_filter_bar_feed_in_feed", FALSE, true); + public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_HISTORY = new BooleanSetting("revanced_hide_filter_bar_feed_in_history", FALSE); public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_RELATED_VIDEOS = new BooleanSetting("revanced_hide_filter_bar_feed_in_related_videos", FALSE, true); public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_SEARCH = new BooleanSetting("revanced_hide_filter_bar_feed_in_search", FALSE, true); public static final BooleanSetting HIDE_FLOATING_MICROPHONE_BUTTON = new BooleanSetting("revanced_hide_floating_microphone_button", TRUE, true); diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt index 711d5af3e..34925d565 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt @@ -201,6 +201,7 @@ val hideLayoutComponentsPatch = bytecodePatch( key = "revanced_hide_filter_bar_screen", preferences = setOf( SwitchPreference("revanced_hide_filter_bar_feed_in_feed"), + SwitchPreference("revanced_hide_filter_bar_feed_in_history"), SwitchPreference("revanced_hide_filter_bar_feed_in_search"), SwitchPreference("revanced_hide_filter_bar_feed_in_related_videos"), ), diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index f5418f8f2..f72851cd4 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -344,10 +344,13 @@ You will not be notified of any unexpected events." Hide or show video description components Filter bar - Hide or show the filter bar in the feed, search results, and related videos - Hide in feed - Hidden in feed - Shown in feed + Hide or show the filter bar in the feeds, history, search results, and related videos + Hide in feeds + Hidden in feeds + Shown in feeds + Hide in history + Hidden in history + Shown in history Hide in search results Hidden in search results Shown in search results