diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/DescriptionComponentsFilter.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/DescriptionComponentsFilter.java index 3aa03ee5c..314b79841 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/DescriptionComponentsFilter.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/DescriptionComponentsFilter.java @@ -7,15 +7,15 @@ import app.revanced.extension.youtube.shared.PlayerType; @SuppressWarnings("unused") final class DescriptionComponentsFilter extends Filter { + private static final String INFOCARDS_SECTION_PATH = "infocards_section.e"; + private final StringTrieSearch exceptions = new StringTrieSearch(); - - private final ByteArrayFilterGroupList macroMarkersCarouselGroupList = new ByteArrayFilterGroupList(); - private final StringFilterGroup macroMarkersCarousel; - + private final ByteArrayFilterGroupList macroMarkersCarouselGroupList = new ByteArrayFilterGroupList(); private final StringFilterGroup horizontalShelf; private final ByteArrayFilterGroup cellVideoAttribute; - + private final StringFilterGroup infoCardsSection; + private final StringFilterGroup subscribeButton; private final StringFilterGroup aiGeneratedVideoSummarySection; private final StringFilterGroup hypePoints; @@ -44,9 +44,10 @@ final class DescriptionComponentsFilter extends Filter { "video_attributes_section" ); - final StringFilterGroup infoCardsSection = new StringFilterGroup( - Settings.HIDE_INFO_CARDS_SECTION, - "infocards_section" + final StringFilterGroup featuredSection = new StringFilterGroup( + Settings.HIDE_FEATURED_SECTION, + // "media_lockup", "structured_description_video_lockup" + "compact_infocard" ); final StringFilterGroup podcastSection = new StringFilterGroup( @@ -69,6 +70,16 @@ final class DescriptionComponentsFilter extends Filter { "hype_points_factoid" ); + infoCardsSection = new StringFilterGroup( + Settings.HIDE_INFO_CARDS_SECTION, + INFOCARDS_SECTION_PATH + ); + + subscribeButton = new StringFilterGroup( + Settings.HIDE_DESCRIPTION_SUBSCRIBE_BUTTON, + "subscribe_button" + ); + macroMarkersCarousel = new StringFilterGroup( null, "macro_markers_carousel.e" @@ -99,12 +110,14 @@ final class DescriptionComponentsFilter extends Filter { aiGeneratedVideoSummarySection, askSection, attributesSection, - infoCardsSection, + featuredSection, horizontalShelf, howThisWasMadeSection, hypePoints, + infoCardsSection, macroMarkersCarousel, podcastSection, + subscribeButton, transcriptSection ); } @@ -118,6 +131,10 @@ final class DescriptionComponentsFilter extends Filter { return PlayerType.getCurrent().isMaximizedOrFullscreen(); } + if (matchedGroup == subscribeButton) { + return path.startsWith(INFOCARDS_SECTION_PATH); + } + if (exceptions.matches(path)) return false; if (matchedGroup == macroMarkersCarousel) { diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java index 48b1a6948..301b40c7a 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java @@ -210,11 +210,13 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_ASK_SECTION = new BooleanSetting("revanced_hide_ask_section", FALSE); public static final BooleanSetting HIDE_ATTRIBUTES_SECTION = new BooleanSetting("revanced_hide_attributes_section", FALSE); public static final BooleanSetting HIDE_CHAPTERS_SECTION = new BooleanSetting("revanced_hide_chapters_section", TRUE); + public static final BooleanSetting HIDE_FEATURED_SECTION = new BooleanSetting("revanced_hide_featured_section", TRUE); public static final BooleanSetting HIDE_HOW_THIS_WAS_MADE_SECTION = new BooleanSetting("revanced_hide_how_this_was_made_section", FALSE); public static final BooleanSetting HIDE_HYPE_POINTS = new BooleanSetting("revanced_hide_hype_points", FALSE); public static final BooleanSetting HIDE_INFO_CARDS_SECTION = new BooleanSetting("revanced_hide_info_cards_section", TRUE); public static final BooleanSetting HIDE_KEY_CONCEPTS_SECTION = new BooleanSetting("revanced_hide_key_concepts_section", FALSE); public static final BooleanSetting HIDE_PODCAST_SECTION = new BooleanSetting("revanced_hide_podcast_section", TRUE); + public static final BooleanSetting HIDE_DESCRIPTION_SUBSCRIBE_BUTTON = new BooleanSetting("revanced_hide_description_subscribe_button", TRUE); public static final BooleanSetting HIDE_TRANSCRIPT_SECTION = new BooleanSetting("revanced_hide_transcript_section", TRUE); // Action buttons diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt index e54b7f1ee..36959f229 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt @@ -145,11 +145,13 @@ val hideLayoutComponentsPatch = bytecodePatch( SwitchPreference("revanced_hide_ask_section"), SwitchPreference("revanced_hide_attributes_section"), SwitchPreference("revanced_hide_chapters_section"), + SwitchPreference("revanced_hide_featured_section"), SwitchPreference("revanced_hide_info_cards_section"), SwitchPreference("revanced_hide_how_this_was_made_section"), SwitchPreference("revanced_hide_hype_points"), SwitchPreference("revanced_hide_key_concepts_section"), SwitchPreference("revanced_hide_podcast_section"), + SwitchPreference("revanced_hide_description_subscribe_button"), SwitchPreference("revanced_hide_transcript_section"), ), ), diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index b231f87b3..3a5c69201 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -346,12 +346,18 @@ If a Doodle is currently showing in your region and this hide setting is on, the Hide \'Explore the podcast\' Explore the podcast section is hidden Explore the podcast section is shown + Hide Featured content + Featured content section is hidden + Featured content section is shown Hide Info cards Info cards section is hidden Info cards section is shown Hide \'Key concepts\' Key concepts section is hidden Key concepts section is shown + Hide Subscribe button + Subscribe button is hidden + Subscribe button is shown Hide Transcript Transcript section is hidden Transcript section is shown