diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/feed/FeedPatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/feed/FeedPatch.java index 05b265ddd6..d8859313b7 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/feed/FeedPatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/feed/FeedPatch.java @@ -35,6 +35,33 @@ public static int hideCategoryBarInSearch(final int height) { return Settings.HIDE_CATEGORY_BAR_IN_SEARCH.get() ? 0 : height; } + /** + * Rather than simply hiding the channel tab view, completely removes channel tab from list. + * If a channel tab is removed from the list, users will not be able to open it by swiping. + * + * @param channelTabText Text to be assigned to channel tab, such as 'Shorts', 'Playlists', 'Community', 'Store'. + * This text is hardcoded, so it follows the user's language. + * @return Whether to remove the channel tab from the list. + */ + public static boolean hideChannelTab(String channelTabText) { + if (!Settings.HIDE_CHANNEL_TAB.get()) { + return false; + } + if (channelTabText == null || channelTabText.isEmpty()) { + return false; + } + + String[] blockList = Settings.HIDE_CHANNEL_TAB_FILTER_STRINGS.get().split("\\n"); + + for (String filter : blockList) { + if (!filter.isEmpty() && channelTabText.equals(filter)) { + return true; + } + } + + return false; + } + public static void hideBreakingNewsShelf(View view) { hideViewBy0dpUnderCondition( Settings.HIDE_CAROUSEL_SHELF.get(), diff --git a/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java b/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java index 41e33bae40..fe3a2ee054 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java @@ -80,6 +80,8 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_CATEGORY_BAR_IN_RELATED_VIDEOS = new BooleanSetting("revanced_hide_category_bar_in_related_videos", FALSE, true); // PreferenceScreen: Feed - Channel profile + public static final BooleanSetting HIDE_CHANNEL_TAB = new BooleanSetting("revanced_hide_channel_tab", FALSE); + public static final StringSetting HIDE_CHANNEL_TAB_FILTER_STRINGS = new StringSetting("revanced_hide_channel_tab_filter_strings", "", true, parent(HIDE_CHANNEL_TAB)); public static final BooleanSetting HIDE_BROWSE_STORE_BUTTON = new BooleanSetting("revanced_hide_browse_store_button", TRUE); public static final BooleanSetting HIDE_CHANNEL_MEMBER_SHELF = new BooleanSetting("revanced_hide_channel_member_shelf", TRUE); public static final BooleanSetting HIDE_CHANNEL_PROFILE_LINKS = new BooleanSetting("revanced_hide_channel_profile_links", TRUE);