diff --git a/extensions/shared/library/src/main/java/app/revanced/extension/shared/settings/Setting.java b/extensions/shared/library/src/main/java/app/revanced/extension/shared/settings/Setting.java index 38b2cee47f..32d24e3e1f 100644 --- a/extensions/shared/library/src/main/java/app/revanced/extension/shared/settings/Setting.java +++ b/extensions/shared/library/src/main/java/app/revanced/extension/shared/settings/Setting.java @@ -58,6 +58,23 @@ public List> getParentSettings() { }; } + /** + * Availability based on a single parent setting being disabled. + */ + public static Availability parentNot(BooleanSetting parent) { + return new Availability() { + @Override + public boolean isAvailable() { + return !parent.get(); + } + + @Override + public List> getParentSettings() { + return Collections.singletonList(parent); + } + }; + } + /** * Availability based on all parents being enabled. */ 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 314b79841c..e7b1af55b6 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 @@ -44,10 +44,14 @@ public DescriptionComponentsFilter() { "video_attributes_section" ); - final StringFilterGroup featuredSection = new StringFilterGroup( - Settings.HIDE_FEATURED_SECTION, - // "media_lockup", "structured_description_video_lockup" - "compact_infocard" + final StringFilterGroup featuredLinksSection = new StringFilterGroup( + Settings.HIDE_FEATURED_LINKS_SECTION, + "media_lockup" + ); + + final StringFilterGroup featuredVideosSection = new StringFilterGroup( + Settings.HIDE_FEATURED_VIDEOS_SECTION, + "structured_description_video_lockup" ); final StringFilterGroup podcastSection = new StringFilterGroup( @@ -76,7 +80,7 @@ public DescriptionComponentsFilter() { ); subscribeButton = new StringFilterGroup( - Settings.HIDE_DESCRIPTION_SUBSCRIBE_BUTTON, + Settings.HIDE_SUBSCRIBE_BUTTON, "subscribe_button" ); @@ -110,7 +114,8 @@ public DescriptionComponentsFilter() { aiGeneratedVideoSummarySection, askSection, attributesSection, - featuredSection, + featuredLinksSection, + featuredVideosSection, horizontalShelf, howThisWasMadeSection, hypePoints, diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java index 00429359f2..9aaec7460f 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java @@ -63,12 +63,18 @@ public LayoutComponentsFilter() { // Identifiers. + final var cellDivider = new StringFilterGroup( + Settings.HIDE_CELL_DIVIDER, + "cell_divider" + ); + final var chipsShelf = new StringFilterGroup( Settings.HIDE_CHIPS_SHELF, "chips_shelf" ); addIdentifierCallbacks( + cellDivider, chipsShelf ); 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 301b40c7a0..38e83826ae 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 @@ -3,6 +3,7 @@ import static java.lang.Boolean.FALSE; import static java.lang.Boolean.TRUE; import static app.revanced.extension.shared.settings.Setting.parent; +import static app.revanced.extension.shared.settings.Setting.parentNot; import static app.revanced.extension.shared.settings.Setting.parentsAll; import static app.revanced.extension.shared.settings.Setting.parentsAny; import static app.revanced.extension.youtube.patches.ChangeFormFactorPatch.FormFactor; @@ -92,6 +93,7 @@ public class Settings extends BaseSettings { // Feed public static final BooleanSetting HIDE_ALBUM_CARDS = new BooleanSetting("revanced_hide_album_cards", FALSE, true); public static final BooleanSetting HIDE_ARTIST_CARDS = new BooleanSetting("revanced_hide_artist_cards", FALSE); + public static final BooleanSetting HIDE_CELL_DIVIDER = new BooleanSetting("revanced_hide_cell_divider", TRUE); public static final BooleanSetting HIDE_CHIPS_SHELF = new BooleanSetting("revanced_hide_chips_shelf", TRUE); public static final BooleanSetting HIDE_COMMUNITY_POSTS = new BooleanSetting("revanced_hide_community_posts", FALSE); public static final BooleanSetting HIDE_COMPACT_BANNER = new BooleanSetting("revanced_hide_compact_banner", TRUE); @@ -210,13 +212,14 @@ 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_FEATURED_LINKS_SECTION = new BooleanSetting("revanced_hide_featured_links_section", FALSE, parentNot(HIDE_INFO_CARDS_SECTION)); + public static final BooleanSetting HIDE_FEATURED_VIDEOS_SECTION = new BooleanSetting("revanced_hide_featured_videos_section", FALSE, parentNot(HIDE_INFO_CARDS_SECTION)); + public static final BooleanSetting HIDE_SUBSCRIBE_BUTTON = new BooleanSetting("revanced_hide_subscribe_button", FALSE, parentNot(HIDE_INFO_CARDS_SECTION)); 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 36959f2299..b05c907908 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,13 +145,14 @@ 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_featured_links_section"), + SwitchPreference("revanced_hide_featured_videos_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_subscribe_button"), SwitchPreference("revanced_hide_transcript_section"), ), ), @@ -223,10 +224,11 @@ val hideLayoutComponentsPatch = bytecodePatch( ), SwitchPreference("revanced_hide_album_cards"), SwitchPreference("revanced_hide_artist_cards"), + SwitchPreference("revanced_hide_cell_divider"), + SwitchPreference("revanced_hide_chips_shelf"), SwitchPreference("revanced_hide_community_posts"), SwitchPreference("revanced_hide_compact_banner"), SwitchPreference("revanced_hide_crowdfunding_box"), - SwitchPreference("revanced_hide_chips_shelf"), SwitchPreference("revanced_hide_expandable_card"), SwitchPreference("revanced_hide_floating_microphone_button"), SwitchPreference( @@ -242,9 +244,9 @@ val hideLayoutComponentsPatch = bytecodePatch( SwitchPreference("revanced_hide_show_more_button"), SwitchPreference("revanced_hide_surveys"), SwitchPreference("revanced_hide_ticket_shelf"), + SwitchPreference("revanced_hide_upload_time"), SwitchPreference("revanced_hide_video_recommendation_labels"), SwitchPreference("revanced_hide_view_count"), - SwitchPreference("revanced_hide_upload_time"), SwitchPreference("revanced_hide_doodles"), ) diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index 38c3bfb9db..b8da1a550e 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -223,6 +223,9 @@ However, enabling this will also log some user data such as your IP address."Hide artist cards Artist cards are hidden Artist cards are shown + Hide cell divider + Cell divider (Visual space) is hidden + Cell divider (Visual space) is shown Hide chips shelf Chips shelf is hidden Chips shelf is shown @@ -346,18 +349,21 @@ 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 Featured links + Featured links section is hidden + Featured links section is shown + Hide Featured videos + Featured videos section is hidden + Featured videos 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 Subscribe button + Subscribe button is hidden + Subscribe button is shown Hide Transcript Transcript section is hidden Transcript section is shown