Skip to content

Commit ba242a3

Browse files
feat(YouTube - Hide layout components): Add Hide in history option to filter bar (#5271)
1 parent 5203da0 commit ba242a3

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public final class LayoutComponentsFilter extends Filter {
3939
private final ByteArrayFilterGroup joinMembershipButton;
4040
private final StringFilterGroup horizontalShelves;
4141
private final ByteArrayFilterGroup ticketShelf;
42+
private final StringFilterGroup chipBar;
4243

4344
public LayoutComponentsFilter() {
4445
exceptions.addPatterns(
@@ -105,6 +106,11 @@ public LayoutComponentsFilter() {
105106
"subscriptions_chip_bar"
106107
);
107108

109+
chipBar = new StringFilterGroup(
110+
Settings.HIDE_FILTER_BAR_FEED_IN_HISTORY,
111+
"chip_bar"
112+
);
113+
108114
inFeedSurvey = new StringFilterGroup(
109115
Settings.HIDE_FEED_SURVEY,
110116
"in_feed_survey",
@@ -272,6 +278,7 @@ public LayoutComponentsFilter() {
272278
emergencyBox,
273279
subscribersCommunityGuidelines,
274280
subscriptionsChipBar,
281+
chipBar,
275282
channelGuidelines,
276283
audioTrackButton,
277284
artistCard,
@@ -314,6 +321,10 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
314321
return contentIndex == 0 && (hideShelves() || ticketShelf.check(protobufBufferArray).isFiltered());
315322
}
316323

324+
if (matchedGroup == chipBar) {
325+
return contentIndex == 0 && NavigationButton.getSelectedNavigationButton() == NavigationButton.LIBRARY;
326+
}
327+
317328
return true;
318329
}
319330

@@ -448,7 +459,7 @@ private static boolean hideShelves() {
448459
}
449460

450461
// Do not hide if the navigation back button is visible,
451-
// otherwise the content shelves in the explore/music/courses pages are hidde.
462+
// otherwise the content shelves in the explore/music/courses pages are hidden.
452463
if (NavigationBar.isBackButtonVisible()) {
453464
return false;
454465
}

extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public class Settings extends BaseSettings {
9898
public static final BooleanSetting HIDE_EXPANDABLE_CHIP = new BooleanSetting("revanced_hide_expandable_chip", TRUE);
9999
public static final BooleanSetting HIDE_FEED_SURVEY = new BooleanSetting("revanced_hide_feed_survey", TRUE);
100100
public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_FEED = new BooleanSetting("revanced_hide_filter_bar_feed_in_feed", FALSE, true);
101+
public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_HISTORY = new BooleanSetting("revanced_hide_filter_bar_feed_in_history", FALSE);
101102
public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_RELATED_VIDEOS = new BooleanSetting("revanced_hide_filter_bar_feed_in_related_videos", FALSE, true);
102103
public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_SEARCH = new BooleanSetting("revanced_hide_filter_bar_feed_in_search", FALSE, true);
103104
public static final BooleanSetting HIDE_FLOATING_MICROPHONE_BUTTON = new BooleanSetting("revanced_hide_floating_microphone_button", TRUE, true);

patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ val hideLayoutComponentsPatch = bytecodePatch(
201201
key = "revanced_hide_filter_bar_screen",
202202
preferences = setOf(
203203
SwitchPreference("revanced_hide_filter_bar_feed_in_feed"),
204+
SwitchPreference("revanced_hide_filter_bar_feed_in_history"),
204205
SwitchPreference("revanced_hide_filter_bar_feed_in_search"),
205206
SwitchPreference("revanced_hide_filter_bar_feed_in_related_videos"),
206207
),

patches/src/main/resources/addresources/values/strings.xml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,13 @@ You will not be notified of any unexpected events."</string>
344344
<string name="revanced_hide_description_components_screen_summary">Hide or show video description components</string>
345345

346346
<string name="revanced_hide_filter_bar_screen_title">Filter bar</string>
347-
<string name="revanced_hide_filter_bar_screen_summary">Hide or show the filter bar in the feed, search results, and related videos</string>
348-
<string name="revanced_hide_filter_bar_feed_in_feed_title">Hide in feed</string>
349-
<string name="revanced_hide_filter_bar_feed_in_feed_summary_on">Hidden in feed</string>
350-
<string name="revanced_hide_filter_bar_feed_in_feed_summary_off">Shown in feed</string>
347+
<string name="revanced_hide_filter_bar_screen_summary">Hide or show the filter bar in the feeds, history, search results, and related videos</string>
348+
<string name="revanced_hide_filter_bar_feed_in_feed_title">Hide in feeds</string>
349+
<string name="revanced_hide_filter_bar_feed_in_feed_summary_on">Hidden in feeds</string>
350+
<string name="revanced_hide_filter_bar_feed_in_feed_summary_off">Shown in feeds</string>
351+
<string name="revanced_hide_filter_bar_feed_in_history_title">Hide in history</string>
352+
<string name="revanced_hide_filter_bar_feed_in_history_summary_on">Hidden in history</string>
353+
<string name="revanced_hide_filter_bar_feed_in_history_summary_off">Shown in history</string>
351354
<string name="revanced_hide_filter_bar_feed_in_search_title">Hide in search results</string>
352355
<string name="revanced_hide_filter_bar_feed_in_search_summary_on">Hidden in search results</string>
353356
<string name="revanced_hide_filter_bar_feed_in_search_summary_off">Shown in search results</string>

0 commit comments

Comments
 (0)