Skip to content

Commit 8e746b0

Browse files
fix(YouTube - Hide layout components): Fix Hide video recommendation labels
1 parent 46547d7 commit 8e746b0

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

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

+4-10
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,8 @@ public LayoutComponentsFilter() {
233233
"mixed_content_shelf"
234234
);
235235

236-
searchResultVideo = new StringFilterGroup(
237-
Settings.HIDE_SEARCH_RESULT_RECOMMENDATIONS,
238-
"search_video_with_context.eml"
239-
);
240-
241-
searchResultRecommendations = new ByteArrayFilterGroup(
242-
Settings.HIDE_SEARCH_RESULT_RECOMMENDATIONS,
236+
searchResultRecommendationLabels = new ByteArrayFilterGroup(
237+
Settings.HIDE_SEARCH_RESULT_RECOMMENDATION_LABELS,
243238
"endorsement_header_footer"
244239
);
245240

@@ -258,7 +253,7 @@ public LayoutComponentsFilter() {
258253
compactChannelBar,
259254
communityPosts,
260255
paidPromotion,
261-
searchResultVideo,
256+
searchResultRecommendationLabels,
262257
latestPosts,
263258
channelWatermark,
264259
communityGuidelines,
@@ -300,8 +295,7 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
300295
return false;
301296
}
302297

303-
if (matchedGroup == searchResultVideo) {
304-
if (searchResultRecommendations.check(protobufBufferArray).isFiltered()) {
298+
if (searchResultRecommendationLabels.check(protobufBufferArray).isFiltered()) {
305299
return super.isFiltered(identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex);
306300
}
307301
return false;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public class Settings extends BaseSettings {
103103
public static final BooleanSetting HIDE_MOVIES_SECTION = new BooleanSetting("revanced_hide_movies_section", TRUE);
104104
public static final BooleanSetting HIDE_NOTIFY_ME_BUTTON = new BooleanSetting("revanced_hide_notify_me_button", TRUE);
105105
public static final BooleanSetting HIDE_PLAYABLES = new BooleanSetting("revanced_hide_playables", TRUE);
106-
public static final BooleanSetting HIDE_SEARCH_RESULT_RECOMMENDATIONS = new BooleanSetting("revanced_hide_search_result_recommendations", TRUE);
106+
public static final BooleanSetting HIDE_SEARCH_RESULT_RECOMMENDATIONS_LABEL = new BooleanSetting("revanced_hide_search_result_recommendation_labels", TRUE);
107107
public static final BooleanSetting HIDE_SHOW_MORE_BUTTON = new BooleanSetting("revanced_hide_show_more_button", TRUE, true);
108108
// Alternative thumbnails
109109
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_HOME = new EnumSetting<>("revanced_alt_thumbnail_home", ThumbnailOption.ORIGINAL);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ val hideLayoutComponentsPatch = bytecodePatch(
222222
SwitchPreference("revanced_hide_movies_section"),
223223
SwitchPreference("revanced_hide_notify_me_button"),
224224
SwitchPreference("revanced_hide_playables"),
225-
SwitchPreference("revanced_hide_search_result_recommendations"),
225+
SwitchPreference("revanced_hide_search_result_recommendation_labels"),
226226
SwitchPreference("revanced_hide_show_more_button"),
227227
SwitchPreference("revanced_hide_doodles"),
228228
)

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ You will not be notified of any unexpected events."</string>
210210
<string name="revanced_hide_notify_me_button_title">Hide \'Notify me\' button</string>
211211
<string name="revanced_hide_notify_me_button_summary_on">Button is hidden</string>
212212
<string name="revanced_hide_notify_me_button_summary_off">Button is shown</string>
213-
<!-- 'People also watched' should be translated using the same localized wording YouTube displays. -->
214-
<string name="revanced_hide_search_result_recommendations_title">Hide \'People also watched\' label</string>
215-
<string name="revanced_hide_search_result_recommendations_summary_on">Label is hidden</string>
216-
<string name="revanced_hide_search_result_recommendations_summary_off">Label is shown</string>
213+
<!-- 'People also watched and You might also like' should be translated using the same localized wording YouTube displays. -->
214+
<string name="revanced_hide_search_result_recommendation_labels_title">Hide video recommendation labels</string>
215+
<string name="revanced_hide_search_result_recommendation_labels_summary_on">People also watched and You might also like labels are hidden</string>
216+
<string name="revanced_hide_search_result_recommendation_labels_summary_off">People also watched and You might also like labels are shown</string>
217217
<!-- 'Show more' should be translated with the same localized wording that YouTube displays.
218218
This button usually appears when searching for a YT creator. -->
219219
<string name="revanced_hide_show_more_button_title">Hide \'Show more\' button</string>

0 commit comments

Comments
 (0)