Skip to content

Commit db796fb

Browse files
feat(YouTube - Hide video action buttons): Add "Hide comments" button
Button is only shown when using YouTube 20.14+ and the video information area is collapsed to a compact state
1 parent 6bb8bad commit db796fb

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ final class ButtonsFilter extends Filter {
77
private static final String COMPACT_CHANNEL_BAR_PATH_PREFIX = "compact_channel_bar.eml";
88
private static final String VIDEO_ACTION_BAR_PATH_PREFIX = "video_action_bar.eml";
99
private static final String VIDEO_ACTION_BAR_PATH = "video_action_bar.eml";
10+
/**
11+
* Video bar path when the video information is collapsed. Seems to shown only with 20.14+
12+
*/
13+
private static final String COMPACTIFY_VIDEO_ACTION_BAR_PATH = "compactify_video_action_bar.eml";
1014
private static final String ANIMATED_VECTOR_TYPE_PATH = "AnimatedVectorType";
1115

1216
private final StringFilterGroup likeSubscribeGlow;
@@ -82,6 +86,10 @@ public ButtonsFilter() {
8286
Settings.HIDE_STOP_ADS_BUTTON,
8387
"yt_outline_slash_circle_left"
8488
),
89+
new ByteArrayFilterGroup(
90+
Settings.HIDE_COMMENTS_BUTTON,
91+
"yt_outline_message_bubble_right"
92+
),
8593
// Check for clip button both here and using a path filter,
8694
// as there's a chance the path is a generic action button and won't contain 'clip_button'
8795
new ByteArrayFilterGroup(
@@ -124,9 +132,8 @@ boolean isFiltered(String identifier, String path, byte[] buffer,
124132
}
125133

126134
if (matchedGroup == bufferFilterPathGroup) {
127-
// Make sure the current path is the right one
128-
// to avoid false positives.
129-
return path.startsWith(VIDEO_ACTION_BAR_PATH)
135+
// Make sure the current path is the right one to avoid false positives.
136+
return (path.startsWith(VIDEO_ACTION_BAR_PATH) || path.startsWith(COMPACTIFY_VIDEO_ACTION_BAR_PATH))
130137
&& bufferButtonsGroupList.check(buffer).isFiltered();
131138
}
132139

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
@@ -222,6 +222,7 @@ public class Settings extends BaseSettings {
222222
public static final BooleanSetting DISABLE_LIKE_SUBSCRIBE_GLOW = new BooleanSetting("revanced_disable_like_subscribe_glow", FALSE);
223223
public static final BooleanSetting HIDE_ASK_BUTTON = new BooleanSetting("revanced_hide_ask_button", FALSE);
224224
public static final BooleanSetting HIDE_CLIP_BUTTON = new BooleanSetting("revanced_hide_clip_button", TRUE);
225+
public static final BooleanSetting HIDE_COMMENTS_BUTTON = new BooleanSetting("revanced_hide_comments_button", TRUE);
225226
public static final BooleanSetting HIDE_DOWNLOAD_BUTTON = new BooleanSetting("revanced_hide_download_button", FALSE);
226227
public static final BooleanSetting HIDE_HYPE_BUTTON = new BooleanSetting("revanced_hide_hype_button", FALSE);
227228
public static final BooleanSetting HIDE_LIKE_DISLIKE_BUTTON = new BooleanSetting("revanced_hide_like_dislike_button", FALSE);

patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ val hideButtonsPatch = resourcePatch(
4141
SwitchPreference("revanced_disable_like_subscribe_glow"),
4242
SwitchPreference("revanced_hide_ask_button"),
4343
SwitchPreference("revanced_hide_clip_button"),
44+
SwitchPreference("revanced_hide_comments_button"),
4445
SwitchPreference("revanced_hide_download_button"),
4546
SwitchPreference("revanced_hide_hype_button"),
4647
SwitchPreference("revanced_hide_like_dislike_button"),

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,10 @@ Adjust volume by swiping vertically on the right side of the screen"</string>
649649
<string name="revanced_hide_stop_ads_button_title">Hide Stop ads</string>
650650
<string name="revanced_hide_stop_ads_button_summary_on">Stop ads button is hidden</string>
651651
<string name="revanced_hide_stop_ads_button_summary_off">Stop ads button is shown</string>
652+
<!-- Button does not have any text and is only shown as an icon, and only when the video information area is collapsed to a compact state. -->
653+
<string name="revanced_hide_comments_button_title">Hide Comments</string>
654+
<string name="revanced_hide_comments_button_summary_on">Comments button is hidden</string>
655+
<string name="revanced_hide_comments_button_summary_off">Comments button is shown</string>
652656
<!-- 'Report' should be translated with the same localized wording that YouTube displays.
653657
This button usually only shows on live streams. -->
654658
<string name="revanced_hide_report_button_title">Hide Report</string>

0 commit comments

Comments
 (0)