Skip to content

Commit 4b8499f

Browse files
author
LisoUseInAIKyrios
authored
fix(YouTube - Hide layout components): Remove broken option 'Hide comments emoji picker' (#5121)
1 parent bde3fda commit 4b8499f

File tree

4 files changed

+9
-27
lines changed

4 files changed

+9
-27
lines changed

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

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
@SuppressWarnings("unused")
88
final class CommentsFilter extends Filter {
99

10-
private static final String TIMESTAMP_OR_EMOJI_BUTTONS_ENDS_WITH_PATH
11-
= "|CellType|ContainerType|ContainerType|ContainerType|ContainerType|ContainerType|";
12-
13-
private final StringFilterGroup commentComposer;
14-
private final ByteArrayFilterGroup emojiPickerBufferGroup;
1510
private final StringFilterGroup filterChipBar;
1611
private final ByteArrayFilterGroup aiCommentsSummary;
1712

@@ -50,14 +45,9 @@ public CommentsFilter() {
5045
"super_thanks_button.eml"
5146
);
5247

53-
commentComposer = new StringFilterGroup(
54-
Settings.HIDE_COMMENTS_TIMESTAMP_AND_EMOJI_BUTTONS,
55-
"comment_composer.eml"
56-
);
57-
58-
emojiPickerBufferGroup = new ByteArrayFilterGroup(
59-
null,
60-
"id.comment.quick_emoji.button"
48+
StringFilterGroup timestampButton = new StringFilterGroup(
49+
Settings.HIDE_COMMENTS_TIMESTAMP_BUTTON,
50+
"composer_timestamp_button.eml"
6151
);
6252

6353
filterChipBar = new StringFilterGroup(
@@ -77,22 +67,14 @@ public CommentsFilter() {
7767
createAShort,
7868
previewComment,
7969
thanksButton,
80-
commentComposer,
70+
timestampButton,
8171
filterChipBar
8272
);
8373
}
8474

8575
@Override
8676
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
8777
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
88-
if (matchedGroup == commentComposer) {
89-
// To completely hide the emoji buttons (and leave no empty space), the timestamp button is
90-
// also hidden because the buffer is exactly the same and there's no way selectively hide.
91-
return contentIndex == 0
92-
&& path.endsWith(TIMESTAMP_OR_EMOJI_BUTTONS_ENDS_WITH_PATH)
93-
&& emojiPickerBufferGroup.check(protobufBufferArray).isFiltered();
94-
}
95-
9678
if (matchedGroup == filterChipBar) {
9779
return aiCommentsSummary.check(protobufBufferArray).isFiltered();
9880
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public class Settings extends BaseSettings {
179179
public static final BooleanSetting HIDE_COMMENTS_AI_SUMMARY = new BooleanSetting("revanced_hide_comments_ai_summary", FALSE);
180180
public static final BooleanSetting HIDE_COMMENTS_BY_MEMBERS_HEADER = new BooleanSetting("revanced_hide_comments_by_members_header", FALSE);
181181
public static final BooleanSetting HIDE_COMMENTS_CREATE_A_SHORT_BUTTON = new BooleanSetting("revanced_hide_comments_create_a_short_button", TRUE);
182-
public static final BooleanSetting HIDE_COMMENTS_TIMESTAMP_AND_EMOJI_BUTTONS = new BooleanSetting("revanced_hide_comments_timestamp_and_emoji_buttons", TRUE);
182+
public static final BooleanSetting HIDE_COMMENTS_TIMESTAMP_BUTTON = new BooleanSetting("revanced_hide_comments_timestamp_button", FALSE);
183183
public static final BooleanSetting HIDE_COMMENTS_PREVIEW_COMMENT = new BooleanSetting("revanced_hide_comments_preview_comment", FALSE);
184184
public static final BooleanSetting HIDE_COMMENTS_SECTION = new BooleanSetting("revanced_hide_comments_section", FALSE);
185185
public static final BooleanSetting HIDE_COMMENTS_THANKS_BUTTON = new BooleanSetting("revanced_hide_comments_thanks_button", TRUE);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ val hideLayoutComponentsPatch = bytecodePatch(
161161
SwitchPreference("revanced_hide_comments_by_members_header"),
162162
SwitchPreference("revanced_hide_comments_section"),
163163
SwitchPreference("revanced_hide_comments_create_a_short_button"),
164-
SwitchPreference("revanced_hide_comments_timestamp_and_emoji_buttons"),
164+
SwitchPreference("revanced_hide_comments_timestamp_button"),
165165
SwitchPreference("revanced_hide_comments_preview_comment"),
166166
SwitchPreference("revanced_hide_comments_thanks_button"),
167167
),

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ You will not be notified of any unexpected events."</string>
371371
<string name="revanced_hide_comments_create_a_short_button_title">Hide \'Create a Short\' button</string>
372372
<string name="revanced_hide_comments_create_a_short_button_summary_on">Create a Short button is hidden</string>
373373
<string name="revanced_hide_comments_create_a_short_button_summary_off">Create a Short button is shown</string>
374-
<string name="revanced_hide_comments_timestamp_and_emoji_buttons_title">Hide emoji and timestamp buttons</string>
375-
<string name="revanced_hide_comments_timestamp_and_emoji_buttons_summary_on">Emoji and timestamp buttons are hidden</string>
376-
<string name="revanced_hide_comments_timestamp_and_emoji_buttons_summary_off">Emoji and timestamp buttons are shown</string>
374+
<string name="revanced_hide_comments_timestamp_button_title">Hide timestamp button</string>
375+
<string name="revanced_hide_comments_timestamp_button_summary_on">Timestamp button is hidden</string>
376+
<string name="revanced_hide_comments_timestamp_button_summary_off">Timestamp button is shown</string>
377377
<string name="revanced_hide_comments_preview_comment_title">Hide preview comment</string>
378378
<string name="revanced_hide_comments_preview_comment_summary_on">Preview comment is hidden</string>
379379
<string name="revanced_hide_comments_preview_comment_summary_off">Preview comment is shown</string>

0 commit comments

Comments
 (0)