Skip to content

Commit 37a9444

Browse files
fix(YouTube - Hide Shorts components): Fix hiding of untoggled components
1 parent 37d16d7 commit 37a9444

File tree

1 file changed

+18
-2
lines changed
  • extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components

1 file changed

+18
-2
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public final class ShortsFilter extends Filter {
4444
private final ByteArrayFilterGroup shortsCompactFeedVideoBuffer;
4545
private final StringFilterGroup useSoundButton;
4646
private final ByteArrayFilterGroup useSoundButtonBuffer;
47+
private final StringFilterGroup useTemplateButton;
48+
private final ByteArrayFilterGroup useTemplateButtonBuffer;
4749

4850
private final StringFilterGroup subscribeButton;
4951
private final StringFilterGroup joinButton;
@@ -187,6 +189,16 @@ public ShortsFilter() {
187189
"yt_outline_camera_"
188190
);
189191

192+
useTemplateButton = new StringFilterGroup(
193+
Settings.HIDE_SHORTS_USE_TEMPLATE_BUTTON,
194+
REEL_METAPANEL_PATH
195+
);
196+
197+
useTemplateButtonBuffer = new ByteArrayFilterGroup(
198+
null,
199+
"yt_outline_template_add_"
200+
);
201+
190202
videoActionButton = new StringFilterGroup(
191203
null,
192204
// Can be simply 'button.eml', 'shorts_video_action_button.eml' or 'reel_action_button.eml'
@@ -195,8 +207,7 @@ public ShortsFilter() {
195207

196208
suggestedAction = new StringFilterGroup(
197209
null,
198-
"suggested_action.eml",
199-
REEL_METAPANEL_PATH
210+
"suggested_action.eml"
200211
);
201212

202213
addPathCallbacks(
@@ -268,6 +279,7 @@ public ShortsFilter() {
268279
),
269280
new ByteArrayFilterGroup(
270281
Settings.HIDE_SHORTS_USE_TEMPLATE_BUTTON,
282+
// "Use this template" can appear in two different places.
271283
"yt_outline_template_add_"
272284
),
273285
new ByteArrayFilterGroup(
@@ -317,6 +329,10 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
317329
return useSoundButtonBuffer.check(protobufBufferArray).isFiltered();
318330
}
319331

332+
if (matchedGroup == useTemplateButton) {
333+
return useTemplateButtonBuffer.check(protobufBufferArray).isFiltered();
334+
}
335+
320336
if (matchedGroup == shortsCompactFeedVideo) {
321337
return shouldHideShortsFeedItems() && shortsCompactFeedVideoBuffer.check(protobufBufferArray).isFiltered();
322338
}

0 commit comments

Comments
 (0)