fix(YouTube - Hide Shorts components): Fix hiding of untoggled components (#5266)
This commit is contained in:
parent
9fa89d48c0
commit
b6bf1e026c
1 changed files with 22 additions and 13 deletions
|
|
@ -44,6 +44,8 @@ public final class ShortsFilter extends Filter {
|
|||
private final ByteArrayFilterGroup shortsCompactFeedVideoBuffer;
|
||||
private final StringFilterGroup useSoundButton;
|
||||
private final ByteArrayFilterGroup useSoundButtonBuffer;
|
||||
private final StringFilterGroup useTemplateButton;
|
||||
private final ByteArrayFilterGroup useTemplateButtonBuffer;
|
||||
|
||||
private final StringFilterGroup subscribeButton;
|
||||
private final StringFilterGroup joinButton;
|
||||
|
|
@ -178,7 +180,10 @@ public final class ShortsFilter extends Filter {
|
|||
|
||||
useSoundButton = new StringFilterGroup(
|
||||
Settings.HIDE_SHORTS_USE_SOUND_BUTTON,
|
||||
// First filter needed for "Use this sound" that can appear when viewing Shorts
|
||||
// through the "Short remixing this video" section.
|
||||
"floating_action_button.eml",
|
||||
// Second filter needed for "Use this sound" that can appear below the video title.
|
||||
REEL_METAPANEL_PATH
|
||||
);
|
||||
|
||||
|
|
@ -187,6 +192,17 @@ public final class ShortsFilter extends Filter {
|
|||
"yt_outline_camera_"
|
||||
);
|
||||
|
||||
useTemplateButton = new StringFilterGroup(
|
||||
Settings.HIDE_SHORTS_USE_TEMPLATE_BUTTON,
|
||||
// Second filter needed for "Use this template" that can appear below the video title.
|
||||
REEL_METAPANEL_PATH
|
||||
);
|
||||
|
||||
useTemplateButtonBuffer = new ByteArrayFilterGroup(
|
||||
null,
|
||||
"yt_outline_template_add_"
|
||||
);
|
||||
|
||||
videoActionButton = new StringFilterGroup(
|
||||
null,
|
||||
// Can be simply 'button.eml', 'shorts_video_action_button.eml' or 'reel_action_button.eml'
|
||||
|
|
@ -195,8 +211,7 @@ public final class ShortsFilter extends Filter {
|
|||
|
||||
suggestedAction = new StringFilterGroup(
|
||||
null,
|
||||
"suggested_action.eml",
|
||||
REEL_METAPANEL_PATH
|
||||
"suggested_action.eml"
|
||||
);
|
||||
|
||||
addPathCallbacks(
|
||||
|
|
@ -268,6 +283,7 @@ public final class ShortsFilter extends Filter {
|
|||
),
|
||||
new ByteArrayFilterGroup(
|
||||
Settings.HIDE_SHORTS_USE_TEMPLATE_BUTTON,
|
||||
// "Use this template" can appear in two different places.
|
||||
"yt_outline_template_add_"
|
||||
),
|
||||
new ByteArrayFilterGroup(
|
||||
|
|
@ -317,6 +333,10 @@ public final class ShortsFilter extends Filter {
|
|||
return useSoundButtonBuffer.check(protobufBufferArray).isFiltered();
|
||||
}
|
||||
|
||||
if (matchedGroup == useTemplateButton) {
|
||||
return useTemplateButtonBuffer.check(protobufBufferArray).isFiltered();
|
||||
}
|
||||
|
||||
if (matchedGroup == shortsCompactFeedVideo) {
|
||||
return shouldHideShortsFeedItems() && shortsCompactFeedVideoBuffer.check(protobufBufferArray).isFiltered();
|
||||
}
|
||||
|
|
@ -402,17 +422,6 @@ public final class ShortsFilter extends Filter {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point. Only used if patching older than 19.03.
|
||||
* This hook may be obsolete even for old versions
|
||||
* as they now use a litho layout like newer versions.
|
||||
*/
|
||||
public static void hideShortsShelf(final View shortsShelfView) {
|
||||
if (shouldHideShortsFeedItems()) {
|
||||
Utils.hideViewByLayoutParams(shortsShelfView);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getSoundButtonSize(int original) {
|
||||
if (Settings.HIDE_SHORTS_SOUND_BUTTON.get()) {
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue