From 02831a6069fc30ffa3a87f8e4de653d003a2187e Mon Sep 17 00:00:00 2001 From: ILoveOpenSourceApplications <117499019+ILoveOpenSourceApplications@users.noreply.github.com> Date: Tue, 9 Dec 2025 02:40:35 +0530 Subject: [PATCH] feat(YouTube - Hide layout components): Add "Hide Join button" and "Hide Subscribe button" options for channel page (#6345) --- .../components/LayoutComponentsFilter.java | 28 +++++--- .../extension/youtube/settings/Settings.java | 14 ++-- .../hide/general/HideLayoutComponentsPatch.kt | 8 ++- .../resources/addresources/values/strings.xml | 64 +++++++++++-------- 4 files changed, 67 insertions(+), 47 deletions(-) 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 9aaec7460..a35bb9e9e 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,19 +63,19 @@ public final class LayoutComponentsFilter extends Filter { // Identifiers. - final var cellDivider = new StringFilterGroup( - Settings.HIDE_CELL_DIVIDER, - "cell_divider" - ); - final var chipsShelf = new StringFilterGroup( Settings.HIDE_CHIPS_SHELF, "chips_shelf" ); + final var visualSpacer = new StringFilterGroup( + Settings.HIDE_VISUAL_SPACER, + "cell_divider" + ); + addIdentifierCallbacks( - cellDivider, - chipsShelf + chipsShelf, + visualSpacer ); // Paths. @@ -266,12 +266,20 @@ public final class LayoutComponentsFilter extends Filter { ); channelProfileBuffer = new ByteArrayFilterGroupList(); channelProfileBuffer.addAll(new ByteArrayFilterGroup( - Settings.HIDE_VISIT_STORE_BUTTON, - "header_store_button" + Settings.HIDE_STORE_BUTTON, + "store_button" ), new ByteArrayFilterGroup( - Settings.HIDE_VISIT_COMMUNITY_BUTTON, + Settings.HIDE_COMMUNITY_BUTTON, "community_button" + ), + new ByteArrayFilterGroup( + Settings.HIDE_JOIN_BUTTON, + "sponsor_button" + ), + new ByteArrayFilterGroup( + Settings.HIDE_SUBSCRIBE_BUTTON_IN_CHANNEL_PAGE, + "subscribe_menu" ) ); 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 37f715e2b..b85939e7e 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 @@ -93,7 +93,6 @@ 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); @@ -117,6 +116,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_UPLOAD_TIME = new BooleanSetting("revanced_hide_upload_time", FALSE, "revanced_hide_upload_time_user_dialog_message"); public static final BooleanSetting HIDE_VIDEO_RECOMMENDATION_LABELS = new BooleanSetting("revanced_hide_video_recommendation_labels", TRUE); public static final BooleanSetting HIDE_VIEW_COUNT = new BooleanSetting("revanced_hide_view_count", FALSE, "revanced_hide_view_count_user_dialog_message"); + public static final BooleanSetting HIDE_VISUAL_SPACER = new BooleanSetting("revanced_hide_visual_spacer", TRUE); // Alternative thumbnails public static final EnumSetting ALT_THUMBNAIL_HOME = new EnumSetting<>("revanced_alt_thumbnail_home", ThumbnailOption.ORIGINAL); @@ -138,11 +138,13 @@ public class Settings extends BaseSettings { parentsAny(HIDE_KEYWORD_CONTENT_HOME, HIDE_KEYWORD_CONTENT_SUBSCRIPTIONS, HIDE_KEYWORD_CONTENT_SEARCH)); // Channel page + public static final BooleanSetting HIDE_COMMUNITY_BUTTON = new BooleanSetting("revanced_hide_community_button", TRUE); public static final BooleanSetting HIDE_FOR_YOU_SHELF = new BooleanSetting("revanced_hide_for_you_shelf", FALSE); + public static final BooleanSetting HIDE_JOIN_BUTTON = new BooleanSetting("revanced_hide_join_button", FALSE); public static final BooleanSetting HIDE_LINKS_PREVIEW = new BooleanSetting("revanced_hide_links_preview", TRUE); public static final BooleanSetting HIDE_MEMBERS_SHELF = new BooleanSetting("revanced_hide_members_shelf", TRUE); - public static final BooleanSetting HIDE_VISIT_COMMUNITY_BUTTON = new BooleanSetting("revanced_hide_visit_community_button", TRUE); - public static final BooleanSetting HIDE_VISIT_STORE_BUTTON = new BooleanSetting("revanced_hide_visit_store_button", TRUE); + public static final BooleanSetting HIDE_STORE_BUTTON = new BooleanSetting("revanced_hide_store_button", TRUE); + public static final BooleanSetting HIDE_SUBSCRIBE_BUTTON_IN_CHANNEL_PAGE = new BooleanSetting("revanced_hide_subscribe_button_in_channel_page", FALSE); // Player public static final BooleanSetting COPY_VIDEO_URL = new BooleanSetting("revanced_copy_video_url", FALSE); @@ -231,11 +233,11 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_HYPE_BUTTON = new BooleanSetting("revanced_hide_hype_button", FALSE); public static final BooleanSetting HIDE_LIKE_DISLIKE_BUTTON = new BooleanSetting("revanced_hide_like_dislike_button", FALSE); public static final BooleanSetting HIDE_PROMOTE_BUTTON = new BooleanSetting("revanced_hide_promote_button", FALSE); - public static final BooleanSetting HIDE_REMIX_BUTTON = new BooleanSetting("revanced_hide_remix_button", TRUE); + public static final BooleanSetting HIDE_REMIX_BUTTON = new BooleanSetting("revanced_hide_remix_button", FALSE); public static final BooleanSetting HIDE_REPORT_BUTTON = new BooleanSetting("revanced_hide_report_button", FALSE); public static final BooleanSetting HIDE_SAVE_BUTTON = new BooleanSetting("revanced_hide_save_button", FALSE); public static final BooleanSetting HIDE_SHARE_BUTTON = new BooleanSetting("revanced_hide_share_button", FALSE); - public static final BooleanSetting HIDE_SHOP_BUTTON = new BooleanSetting("revanced_hide_shop_button", FALSE); + public static final BooleanSetting HIDE_SHOP_BUTTON = new BooleanSetting("revanced_hide_shop_button", TRUE); public static final BooleanSetting HIDE_STOP_ADS_BUTTON = new BooleanSetting("revanced_hide_stop_ads_button", TRUE); public static final BooleanSetting HIDE_THANKS_BUTTON = new BooleanSetting("revanced_hide_thanks_button", TRUE); @@ -315,7 +317,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_SHORTS_NAVIGATION_BAR = new BooleanSetting("revanced_hide_shorts_navigation_bar", FALSE, true); public static final BooleanSetting HIDE_SHORTS_PAUSED_OVERLAY_BUTTONS = new BooleanSetting("revanced_hide_shorts_paused_overlay_buttons", FALSE); public static final BooleanSetting HIDE_SHORTS_PREVIEW_COMMENT = new BooleanSetting("revanced_hide_shorts_preview_comment", TRUE); - public static final BooleanSetting HIDE_SHORTS_REMIX_BUTTON = new BooleanSetting("revanced_hide_shorts_remix_button", TRUE); + public static final BooleanSetting HIDE_SHORTS_REMIX_BUTTON = new BooleanSetting("revanced_hide_shorts_remix_button", FALSE); public static final BooleanSetting HIDE_SHORTS_SAVE_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_save_sound_button", TRUE); public static final BooleanSetting HIDE_SHORTS_SEARCH = new BooleanSetting("revanced_hide_shorts_search", FALSE); public static final BooleanSetting HIDE_SHORTS_SEARCH_SUGGESTIONS = new BooleanSetting("revanced_hide_shorts_search_suggestions", TRUE); 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 b05c90790..ae62a4914 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 @@ -215,16 +215,17 @@ val hideLayoutComponentsPatch = bytecodePatch( PreferenceScreenPreference( key = "revanced_channel_screen", preferences = setOf( + SwitchPreference("revanced_hide_community_button"), SwitchPreference("revanced_hide_for_you_shelf"), + SwitchPreference("revanced_hide_join_button"), SwitchPreference("revanced_hide_links_preview"), SwitchPreference("revanced_hide_members_shelf"), - SwitchPreference("revanced_hide_visit_community_button"), - SwitchPreference("revanced_hide_visit_store_button"), + SwitchPreference("revanced_hide_store_button"), + SwitchPreference("revanced_hide_subscribe_button_in_channel_page"), ), ), 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"), @@ -247,6 +248,7 @@ val hideLayoutComponentsPatch = bytecodePatch( SwitchPreference("revanced_hide_upload_time"), SwitchPreference("revanced_hide_video_recommendation_labels"), SwitchPreference("revanced_hide_view_count"), + SwitchPreference("revanced_hide_visual_spacer"), 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 7580fca19..ddb6d1d70 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -223,9 +223,6 @@ 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 @@ -289,6 +286,9 @@ However, enabling this will also log some user data such as your IP address."Hide video recommendation labels \'People also watched\' and \'You might also like\' labels in search results are hidden \'People also watched\' and \'You might also like\' labels in search results are shown + Hide visual spacer + Visual spacer is hidden + Visual spacer is shown Hide YouTube Doodles YouTube Doodles animation on the logo is hidden @@ -387,24 +387,32 @@ If a Doodle is currently showing in your region and this hide setting is on, the Channel page Hide or show channel page components + + Hide Community button + Community button is hidden + Community button is shown Hide \'For You\' shelf For You shelf is hidden For You shelf is shown + + Hide Join button + Join button is hidden + Join button is shown Hide links preview Links preview is hidden Links preview is shown Hide members shelf Members shelf is hidden Members shelf is shown - - Hide \'Visit Community\' button - Visit Community button is hidden - Visit Community button is shown - - Hide \'Visit store\' button - Visit store button is hidden - Visit store button is shown + + Hide Store button + Store button is hidden + Store button is shown + + Hide Subscribe button + Subscribe button is hidden + Subscribe button is shown Comments Hide or show comments section components @@ -547,11 +555,11 @@ This feature is only available for older devices" URL copied to clipboard URL with timestamp copied Show copy video URL button - Button is shown. Tap to copy video URL. Tap and hold to copy with timestamp - Button is not shown + Copy video URL button is shown. Tap to copy video URL. Tap and hold to copy with timestamp + Copy video URL button is not shown Show copy timestamp URL button - Button is shown. Tap to copy video URL with timestamp. Tap and hold to copy without timestamp - Button is not shown + Copy timestamp URL button is shown. Tap to copy video URL with timestamp. Tap and hold to copy without timestamp + Copy timestamp URL button is not shown Remove viewer discretion dialog @@ -560,7 +568,7 @@ This feature is only available for older devices" This does not bypass the age restriction. It just accepts it automatically. - Disable Sign in to TV popup + Disable \'Sign in to TV\' popup Sign in to TV popup is disabled Sign in to TV popup is enabled @@ -692,7 +700,7 @@ Adjust volume by swiping vertically on the right side of the screen" Download button is hidden Download button is shown + This button only shows on videos uploaded by the logged-in user. --> Hide Hype Hype button is hidden Hype button is shown @@ -893,16 +901,16 @@ To show the Audio track menu, change \'Spoof video streams\' to \'Android No SDK Hide Shorts in watch history Hidden in watch history Shown in watch history - Hide auto-dubbed label + Hide \'Auto-dubbed\' label Auto-dubbed label is hidden Auto-dubbed label is shown - Hide Buy Super Thanks button + Hide \'Buy Super Thanks\' button Buy Super Thanks button is hidden Buy Super Thanks button is shown Hide Effect button Effect button is hidden Effect button is shown - Hide Green screen button + Hide \'Green screen\' button Green screen button is hidden Green screen button is shown Hide Hashtag button @@ -918,7 +926,7 @@ To show the Audio track menu, change \'Spoof video streams\' to \'Android No SDK Hide location label Location label is hidden Location label is shown - Hide New posts button + Hide \'New posts\' button New posts button is hidden New posts button is shown Hide paused overlay buttons @@ -927,7 +935,7 @@ To show the Audio track menu, change \'Spoof video streams\' to \'Android No SDK Hide preview comment Preview comment is hidden Preview comment is shown - Hide Save music button + Hide \'Save music\' button Save music button is hidden Save music button is shown Hide search suggestions @@ -948,10 +956,10 @@ To show the Audio track menu, change \'Spoof video streams\' to \'Android No SDK Hide Upcoming button Upcoming button is hidden Upcoming button is shown - Hide Use this sound button + Hide \'Use this sound\' button Use this sound button is hidden Use this sound button is shown - Hide Use this template button + Hide \'Use this template\' button Use this template button is hidden Use this template button is shown Hide Like button fountain animation @@ -1612,13 +1620,13 @@ Enabling this can unlock higher video qualities" Show speed dialog button - Button is shown. Tap and hold to reset playback speed to default - Button is not shown + Speed dialog button is shown. Tap and hold to reset playback speed to default + Speed dialog button is not shown Show video quality button - Button is shown. Tap and hold to reset quality to default - Button is not shown + Video quality button is shown. Tap and hold to reset quality to default + Video quality button is not shown Custom playback speed menu