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 ByteArrayFilterGroup shortsCompactFeedVideoBuffer;
|
||||||
private final StringFilterGroup useSoundButton;
|
private final StringFilterGroup useSoundButton;
|
||||||
private final ByteArrayFilterGroup useSoundButtonBuffer;
|
private final ByteArrayFilterGroup useSoundButtonBuffer;
|
||||||
|
private final StringFilterGroup useTemplateButton;
|
||||||
|
private final ByteArrayFilterGroup useTemplateButtonBuffer;
|
||||||
|
|
||||||
private final StringFilterGroup subscribeButton;
|
private final StringFilterGroup subscribeButton;
|
||||||
private final StringFilterGroup joinButton;
|
private final StringFilterGroup joinButton;
|
||||||
|
|
@ -178,7 +180,10 @@ public final class ShortsFilter extends Filter {
|
||||||
|
|
||||||
useSoundButton = new StringFilterGroup(
|
useSoundButton = new StringFilterGroup(
|
||||||
Settings.HIDE_SHORTS_USE_SOUND_BUTTON,
|
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",
|
"floating_action_button.eml",
|
||||||
|
// Second filter needed for "Use this sound" that can appear below the video title.
|
||||||
REEL_METAPANEL_PATH
|
REEL_METAPANEL_PATH
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -187,6 +192,17 @@ public final class ShortsFilter extends Filter {
|
||||||
"yt_outline_camera_"
|
"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(
|
videoActionButton = new StringFilterGroup(
|
||||||
null,
|
null,
|
||||||
// Can be simply 'button.eml', 'shorts_video_action_button.eml' or 'reel_action_button.eml'
|
// 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(
|
suggestedAction = new StringFilterGroup(
|
||||||
null,
|
null,
|
||||||
"suggested_action.eml",
|
"suggested_action.eml"
|
||||||
REEL_METAPANEL_PATH
|
|
||||||
);
|
);
|
||||||
|
|
||||||
addPathCallbacks(
|
addPathCallbacks(
|
||||||
|
|
@ -268,6 +283,7 @@ public final class ShortsFilter extends Filter {
|
||||||
),
|
),
|
||||||
new ByteArrayFilterGroup(
|
new ByteArrayFilterGroup(
|
||||||
Settings.HIDE_SHORTS_USE_TEMPLATE_BUTTON,
|
Settings.HIDE_SHORTS_USE_TEMPLATE_BUTTON,
|
||||||
|
// "Use this template" can appear in two different places.
|
||||||
"yt_outline_template_add_"
|
"yt_outline_template_add_"
|
||||||
),
|
),
|
||||||
new ByteArrayFilterGroup(
|
new ByteArrayFilterGroup(
|
||||||
|
|
@ -317,6 +333,10 @@ public final class ShortsFilter extends Filter {
|
||||||
return useSoundButtonBuffer.check(protobufBufferArray).isFiltered();
|
return useSoundButtonBuffer.check(protobufBufferArray).isFiltered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (matchedGroup == useTemplateButton) {
|
||||||
|
return useTemplateButtonBuffer.check(protobufBufferArray).isFiltered();
|
||||||
|
}
|
||||||
|
|
||||||
if (matchedGroup == shortsCompactFeedVideo) {
|
if (matchedGroup == shortsCompactFeedVideo) {
|
||||||
return shouldHideShortsFeedItems() && shortsCompactFeedVideoBuffer.check(protobufBufferArray).isFiltered();
|
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) {
|
public static int getSoundButtonSize(int original) {
|
||||||
if (Settings.HIDE_SHORTS_SOUND_BUTTON.get()) {
|
if (Settings.HIDE_SHORTS_SOUND_BUTTON.get()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue