Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
feat(YouTube/Hide feed components): add Channel tab filter settings
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Apr 25, 2024
1 parent cd511f0 commit fa699bc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fa699bc

Please sign in to comment.