mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-29 22:24:31 +02:00
fix(YouTube - Description components): Hide Attributes section
setting not working for some users
This commit is contained in:
parent
4f4719fd7c
commit
842bde5a8a
@ -7,12 +7,15 @@ import app.revanced.extension.shared.patches.components.ByteArrayFilterGroupList
|
|||||||
import app.revanced.extension.shared.patches.components.Filter;
|
import app.revanced.extension.shared.patches.components.Filter;
|
||||||
import app.revanced.extension.shared.patches.components.StringFilterGroup;
|
import app.revanced.extension.shared.patches.components.StringFilterGroup;
|
||||||
import app.revanced.extension.youtube.settings.Settings;
|
import app.revanced.extension.youtube.settings.Settings;
|
||||||
|
import app.revanced.extension.youtube.shared.EngagementPanel;
|
||||||
|
import app.revanced.extension.youtube.shared.RootView;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public final class DescriptionsFilter extends Filter {
|
public final class DescriptionsFilter extends Filter {
|
||||||
private final ByteArrayFilterGroupList macroMarkerShelfGroupList = new ByteArrayFilterGroupList();
|
private final ByteArrayFilterGroupList macroMarkerShelfGroupList = new ByteArrayFilterGroupList();
|
||||||
|
|
||||||
private final StringFilterGroup howThisWasMadeSection;
|
private final StringFilterGroup howThisWasMadeSection;
|
||||||
|
private final StringFilterGroup horizontalShelf;
|
||||||
private final StringFilterGroup infoCardsSection;
|
private final StringFilterGroup infoCardsSection;
|
||||||
private final StringFilterGroup macroMarkerShelf;
|
private final StringFilterGroup macroMarkerShelf;
|
||||||
private final StringFilterGroup shoppingLinks;
|
private final StringFilterGroup shoppingLinks;
|
||||||
@ -54,6 +57,13 @@ public final class DescriptionsFilter extends Filter {
|
|||||||
"how_this_was_made_section.eml"
|
"how_this_was_made_section.eml"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// In the latest YouTube, the Attribute section has the same path as the Carousel shelf.
|
||||||
|
// To hide only the Attribute section, check if the Description panel is open.
|
||||||
|
horizontalShelf = new StringFilterGroup(
|
||||||
|
Settings.HIDE_ATTRIBUTES_SECTION,
|
||||||
|
"horizontal_shelf.eml"
|
||||||
|
);
|
||||||
|
|
||||||
infoCardsSection = new StringFilterGroup(
|
infoCardsSection = new StringFilterGroup(
|
||||||
Settings.HIDE_INFO_CARDS_SECTION,
|
Settings.HIDE_INFO_CARDS_SECTION,
|
||||||
"infocards_section.eml"
|
"infocards_section.eml"
|
||||||
@ -72,6 +82,7 @@ public final class DescriptionsFilter extends Filter {
|
|||||||
|
|
||||||
addPathCallbacks(
|
addPathCallbacks(
|
||||||
howThisWasMadeSection,
|
howThisWasMadeSection,
|
||||||
|
horizontalShelf,
|
||||||
infoCardsSection,
|
infoCardsSection,
|
||||||
macroMarkerShelf,
|
macroMarkerShelf,
|
||||||
shoppingLinks
|
shoppingLinks
|
||||||
@ -104,6 +115,16 @@ public final class DescriptionsFilter extends Filter {
|
|||||||
if (!macroMarkerShelfGroupList.check(protobufBufferArray).isFiltered()) {
|
if (!macroMarkerShelfGroupList.check(protobufBufferArray).isFiltered()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (matchedGroup == horizontalShelf) {
|
||||||
|
if (contentIndex != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!RootView.isPlayerActive()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!EngagementPanel.isDescription()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
|
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
|
||||||
|
@ -6,7 +6,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||||||
|
|
||||||
import app.revanced.extension.shared.utils.Logger;
|
import app.revanced.extension.shared.utils.Logger;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings({"unused", "BooleanMethodIsAlwaysInverted"})
|
||||||
public final class EngagementPanel {
|
public final class EngagementPanel {
|
||||||
private static final AtomicReference<String> engagementPanelId = new AtomicReference<>("");
|
private static final AtomicReference<String> engagementPanelId = new AtomicReference<>("");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user