Skip to content

fix(YouTube - Hide layout components): Fix Hide video recommendation labels #4956

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 4 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 @@ -34,8 +34,6 @@ public final class LayoutComponentsFilter extends Filter {
private final StringFilterGroup notifyMe;
private final StringFilterGroup singleItemInformationPanel;
private final StringFilterGroup expandableMetadata;
private final ByteArrayFilterGroup searchResultRecommendations;
private final StringFilterGroup searchResultVideo;
private final StringFilterGroup compactChannelBarInner;
private final StringFilterGroup compactChannelBarInnerButton;
private final ByteArrayFilterGroup joinMembershipButton;
Expand Down Expand Up @@ -233,14 +231,9 @@ public LayoutComponentsFilter() {
"mixed_content_shelf"
);

searchResultVideo = new StringFilterGroup(
Settings.HIDE_SEARCH_RESULT_RECOMMENDATIONS,
"search_video_with_context.eml"
);

searchResultRecommendations = new ByteArrayFilterGroup(
Settings.HIDE_SEARCH_RESULT_RECOMMENDATIONS,
"endorsement_header_footer"
final var searchResultRecommendationLabels = new StringFilterGroup(
Settings.HIDE_SEARCH_RESULT_RECOMMENDATION_LABELS,
"endorsement_header_footer.eml"
);

horizontalShelves = new StringFilterGroup(
Expand All @@ -258,7 +251,7 @@ public LayoutComponentsFilter() {
compactChannelBar,
communityPosts,
paidPromotion,
searchResultVideo,
searchResultRecommendationLabels,
latestPosts,
channelWatermark,
communityGuidelines,
Expand Down Expand Up @@ -300,13 +293,6 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
return false;
}

if (matchedGroup == searchResultVideo) {
if (searchResultRecommendations.check(protobufBufferArray).isFiltered()) {
return super.isFiltered(identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
return false;
}

// The groups are excluded from the filter due to the exceptions list below.
// Filter them separately here.
if (matchedGroup == notifyMe || matchedGroup == inFeedSurvey || matchedGroup == expandableMetadata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_MOVIES_SECTION = new BooleanSetting("revanced_hide_movies_section", TRUE);
public static final BooleanSetting HIDE_NOTIFY_ME_BUTTON = new BooleanSetting("revanced_hide_notify_me_button", TRUE);
public static final BooleanSetting HIDE_PLAYABLES = new BooleanSetting("revanced_hide_playables", TRUE);
public static final BooleanSetting HIDE_SEARCH_RESULT_RECOMMENDATIONS = new BooleanSetting("revanced_hide_search_result_recommendations", TRUE);
public static final BooleanSetting HIDE_SEARCH_RESULT_RECOMMENDATION_LABELS = new BooleanSetting("revanced_hide_search_result_recommendation_labels", TRUE);
public static final BooleanSetting HIDE_SHOW_MORE_BUTTON = new BooleanSetting("revanced_hide_show_more_button", TRUE, true);
// Alternative thumbnails
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_HOME = new EnumSetting<>("revanced_alt_thumbnail_home", ThumbnailOption.ORIGINAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ val hideLayoutComponentsPatch = bytecodePatch(
SwitchPreference("revanced_hide_movies_section"),
SwitchPreference("revanced_hide_notify_me_button"),
SwitchPreference("revanced_hide_playables"),
SwitchPreference("revanced_hide_search_result_recommendations"),
SwitchPreference("revanced_hide_search_result_recommendation_labels"),
SwitchPreference("revanced_hide_show_more_button"),
SwitchPreference("revanced_hide_doodles"),
)
Expand Down
8 changes: 4 additions & 4 deletions patches/src/main/resources/addresources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ You will not be notified of any unexpected events."</string>
<string name="revanced_hide_notify_me_button_title">Hide \'Notify me\' button</string>
<string name="revanced_hide_notify_me_button_summary_on">Button is hidden</string>
<string name="revanced_hide_notify_me_button_summary_off">Button is shown</string>
<!-- 'People also watched' should be translated using the same localized wording YouTube displays. -->
<string name="revanced_hide_search_result_recommendations_title">Hide \'People also watched\' label</string>
<string name="revanced_hide_search_result_recommendations_summary_on">Label is hidden</string>
<string name="revanced_hide_search_result_recommendations_summary_off">Label is shown</string>
<!-- 'People also watched and You might also like' should be translated using the same localized wording YouTube displays. -->
<string name="revanced_hide_search_result_recommendation_labels_title">Hide video recommendation labels</string>
<string name="revanced_hide_search_result_recommendation_labels_summary_on">People also watched and You might also like labels are hidden</string>
<string name="revanced_hide_search_result_recommendation_labels_summary_off">People also watched and You might also like labels are shown</string>
<!-- 'Show more' should be translated with the same localized wording that YouTube displays.
This button usually appears when searching for a YT creator. -->
<string name="revanced_hide_show_more_button_title">Hide \'Show more\' button</string>
Expand Down
Loading