Skip to content

feat(YouTube - Hide layout components): Add Hide in history option to filter bar #5271

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

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
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -105,6 +106,11 @@ public LayoutComponentsFilter() {
"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",
Expand Down Expand Up @@ -272,6 +278,7 @@ public LayoutComponentsFilter() {
emergencyBox,
subscribersCommunityGuidelines,
subscriptionsChipBar,
chipBar,
channelGuidelines,
audioTrackButton,
artistCard,
Expand Down Expand Up @@ -314,6 +321,10 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
return contentIndex == 0 && (hideShelves() || ticketShelf.check(protobufBufferArray).isFiltered());
}

if (matchedGroup == chipBar) {
return contentIndex == 0 && NavigationButton.getSelectedNavigationButton() == NavigationButton.LIBRARY;
}

return true;
}

Expand Down Expand Up @@ -448,7 +459,7 @@ private static boolean hideShelves() {
}

// 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
Expand Down
11 changes: 7 additions & 4 deletions patches/src/main/resources/addresources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,13 @@ You will not be notified of any unexpected events."</string>
<string name="revanced_hide_description_components_screen_summary">Hide or show video description components</string>

<string name="revanced_hide_filter_bar_screen_title">Filter bar</string>
<string name="revanced_hide_filter_bar_screen_summary">Hide or show the filter bar in the feed, search results, and related videos</string>
<string name="revanced_hide_filter_bar_feed_in_feed_title">Hide in feed</string>
<string name="revanced_hide_filter_bar_feed_in_feed_summary_on">Hidden in feed</string>
<string name="revanced_hide_filter_bar_feed_in_feed_summary_off">Shown in feed</string>
<string name="revanced_hide_filter_bar_screen_summary">Hide or show the filter bar in the feeds, history, search results, and related videos</string>
<string name="revanced_hide_filter_bar_feed_in_feed_title">Hide in feeds</string>
<string name="revanced_hide_filter_bar_feed_in_feed_summary_on">Hidden in feeds</string>
<string name="revanced_hide_filter_bar_feed_in_feed_summary_off">Shown in feeds</string>
<string name="revanced_hide_filter_bar_feed_in_history_title">Hide in history</string>
<string name="revanced_hide_filter_bar_feed_in_history_summary_on">Hidden in history</string>
<string name="revanced_hide_filter_bar_feed_in_history_summary_off">Shown in history</string>
<string name="revanced_hide_filter_bar_feed_in_search_title">Hide in search results</string>
<string name="revanced_hide_filter_bar_feed_in_search_summary_on">Hidden in search results</string>
<string name="revanced_hide_filter_bar_feed_in_search_summary_off">Shown in search results</string>
Expand Down
Loading