feat(YouTube - Hide layout components): Add "Hide Emoji and Timestamp buttons" setting (#5992)

This commit is contained in:
ILoveOpenSourceApplications
2025-09-25 01:47:08 +05:30
committed by GitHub
parent fb87199514
commit 2b555f67f0
4 changed files with 19 additions and 12 deletions

View File

@@ -6,8 +6,11 @@ import app.revanced.extension.youtube.shared.PlayerType;
@SuppressWarnings("unused") @SuppressWarnings("unused")
final class CommentsFilter extends Filter { final class CommentsFilter extends Filter {
private static final String COMMENT_COMPOSER_PATH = "comment_composer.eml";
private final StringFilterGroup chipBar; private final StringFilterGroup chipBar;
private final ByteArrayFilterGroup aiCommentsSummary; private final ByteArrayFilterGroup aiCommentsSummary;
private final StringFilterGroup emojiAndTimestampButtons;
public CommentsFilter() { public CommentsFilter() {
var chatSummary = new StringFilterGroup( var chatSummary = new StringFilterGroup(
@@ -52,6 +55,11 @@ final class CommentsFilter extends Filter {
"composer_short_creation_button.eml" "composer_short_creation_button.eml"
); );
emojiAndTimestampButtons = new StringFilterGroup(
Settings.HIDE_COMMENTS_EMOJI_AND_TIMESTAMP_BUTTONS,
"|CellType|ContainerType|ContainerType|ContainerType|ContainerType|ContainerType|"
);
var previewComment = new StringFilterGroup( var previewComment = new StringFilterGroup(
Settings.HIDE_COMMENTS_PREVIEW_COMMENT, Settings.HIDE_COMMENTS_PREVIEW_COMMENT,
"|carousel_item", "|carousel_item",
@@ -64,11 +72,6 @@ final class CommentsFilter extends Filter {
"super_thanks_button.eml" "super_thanks_button.eml"
); );
StringFilterGroup timestampButton = new StringFilterGroup(
Settings.HIDE_COMMENTS_TIMESTAMP_BUTTON,
"composer_timestamp_button.eml"
);
addPathCallbacks( addPathCallbacks(
channelGuidelines, channelGuidelines,
chatSummary, chatSummary,
@@ -77,9 +80,9 @@ final class CommentsFilter extends Filter {
comments, comments,
communityGuidelines, communityGuidelines,
createAShort, createAShort,
emojiAndTimestampButtons,
previewComment, previewComment,
thanksButton, thanksButton
timestampButton
); );
} }
@@ -93,6 +96,10 @@ final class CommentsFilter extends Filter {
&& aiCommentsSummary.check(buffer).isFiltered(); && aiCommentsSummary.check(buffer).isFiltered();
} }
if (matchedGroup == emojiAndTimestampButtons) {
return path.startsWith(COMMENT_COMPOSER_PATH);
}
return true; return true;
} }
} }

View File

@@ -199,9 +199,9 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_COMMENTS_COMMUNITY_GUIDELINES = new BooleanSetting("revanced_hide_comments_community_guidelines", TRUE); public static final BooleanSetting HIDE_COMMENTS_COMMUNITY_GUIDELINES = new BooleanSetting("revanced_hide_comments_community_guidelines", TRUE);
public static final BooleanSetting HIDE_COMMENTS_CREATE_A_SHORT_BUTTON = new BooleanSetting("revanced_hide_comments_create_a_short_button", TRUE); public static final BooleanSetting HIDE_COMMENTS_CREATE_A_SHORT_BUTTON = new BooleanSetting("revanced_hide_comments_create_a_short_button", TRUE);
public static final BooleanSetting HIDE_COMMENTS_PREVIEW_COMMENT = new BooleanSetting("revanced_hide_comments_preview_comment", FALSE); public static final BooleanSetting HIDE_COMMENTS_PREVIEW_COMMENT = new BooleanSetting("revanced_hide_comments_preview_comment", FALSE);
public static final BooleanSetting HIDE_COMMENTS_EMOJI_AND_TIMESTAMP_BUTTONS = new BooleanSetting("revanced_hide_comments_emoji_and_timestamp_buttons", FALSE);
public static final BooleanSetting HIDE_COMMENTS_SECTION = new BooleanSetting("revanced_hide_comments_section", FALSE); public static final BooleanSetting HIDE_COMMENTS_SECTION = new BooleanSetting("revanced_hide_comments_section", FALSE);
public static final BooleanSetting HIDE_COMMENTS_THANKS_BUTTON = new BooleanSetting("revanced_hide_comments_thanks_button", TRUE); public static final BooleanSetting HIDE_COMMENTS_THANKS_BUTTON = new BooleanSetting("revanced_hide_comments_thanks_button", TRUE);
public static final BooleanSetting HIDE_COMMENTS_TIMESTAMP_BUTTON = new BooleanSetting("revanced_hide_comments_timestamp_button", FALSE);
// Description // Description
public static final BooleanSetting HIDE_AI_GENERATED_VIDEO_SUMMARY_SECTION = new BooleanSetting("revanced_hide_ai_generated_video_summary_section", FALSE); public static final BooleanSetting HIDE_AI_GENERATED_VIDEO_SUMMARY_SECTION = new BooleanSetting("revanced_hide_ai_generated_video_summary_section", FALSE);

View File

@@ -161,9 +161,9 @@ val hideLayoutComponentsPatch = bytecodePatch(
SwitchPreference("revanced_hide_comments_section"), SwitchPreference("revanced_hide_comments_section"),
SwitchPreference("revanced_hide_comments_community_guidelines"), SwitchPreference("revanced_hide_comments_community_guidelines"),
SwitchPreference("revanced_hide_comments_create_a_short_button"), SwitchPreference("revanced_hide_comments_create_a_short_button"),
SwitchPreference("revanced_hide_comments_emoji_and_timestamp_buttons"),
SwitchPreference("revanced_hide_comments_preview_comment"), SwitchPreference("revanced_hide_comments_preview_comment"),
SwitchPreference("revanced_hide_comments_thanks_button"), SwitchPreference("revanced_hide_comments_thanks_button"),
SwitchPreference("revanced_hide_comments_timestamp_button"),
), ),
sorting = PreferenceScreenPreference.Sorting.UNSORTED, sorting = PreferenceScreenPreference.Sorting.UNSORTED,
), ),

View File

@@ -441,15 +441,15 @@ If a Doodle is currently showing in your region and this hide setting is on, the
<string name="revanced_hide_comments_create_a_short_button_title">Hide \'Create a Short\' button</string> <string name="revanced_hide_comments_create_a_short_button_title">Hide \'Create a Short\' button</string>
<string name="revanced_hide_comments_create_a_short_button_summary_on">Create a Short button is hidden</string> <string name="revanced_hide_comments_create_a_short_button_summary_on">Create a Short button is hidden</string>
<string name="revanced_hide_comments_create_a_short_button_summary_off">Create a Short button is shown</string> <string name="revanced_hide_comments_create_a_short_button_summary_off">Create a Short button is shown</string>
<string name="revanced_hide_comments_emoji_and_timestamp_buttons_title">Hide Emoji and Timestamp buttons</string>
<string name="revanced_hide_comments_emoji_and_timestamp_buttons_summary_on">Emoji and Timestamp buttons are hidden</string>
<string name="revanced_hide_comments_emoji_and_timestamp_buttons_summary_off">Emoji and Timestamp buttons are shown</string>
<string name="revanced_hide_comments_preview_comment_title">Hide preview comment</string> <string name="revanced_hide_comments_preview_comment_title">Hide preview comment</string>
<string name="revanced_hide_comments_preview_comment_summary_on">Preview comment is hidden</string> <string name="revanced_hide_comments_preview_comment_summary_on">Preview comment is hidden</string>
<string name="revanced_hide_comments_preview_comment_summary_off">Preview comment is shown</string> <string name="revanced_hide_comments_preview_comment_summary_off">Preview comment is shown</string>
<string name="revanced_hide_comments_thanks_button_title">Hide Thanks button</string> <string name="revanced_hide_comments_thanks_button_title">Hide Thanks button</string>
<string name="revanced_hide_comments_thanks_button_summary_on">Thanks button is hidden</string> <string name="revanced_hide_comments_thanks_button_summary_on">Thanks button is hidden</string>
<string name="revanced_hide_comments_thanks_button_summary_off">Thanks button is shown</string> <string name="revanced_hide_comments_thanks_button_summary_off">Thanks button is shown</string>
<string name="revanced_hide_comments_timestamp_button_title">Hide Timestamp button</string>
<string name="revanced_hide_comments_timestamp_button_summary_on">Timestamp button is hidden</string>
<string name="revanced_hide_comments_timestamp_button_summary_off">Timestamp button is shown</string>
<string name="revanced_custom_filter_screen_title">Custom filter</string> <string name="revanced_custom_filter_screen_title">Custom filter</string>
<string name="revanced_custom_filter_screen_summary">Hide components using custom filters</string> <string name="revanced_custom_filter_screen_summary">Hide components using custom filters</string>