Skip to content

Commit

Permalink
feat(YouTube/Description components): add Hide Contents section set…
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Jul 26, 2024
1 parent c228718 commit 8cf8fc8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@
public final class DescriptionsFilter extends Filter {
private final ByteArrayFilterGroupList macroMarkerShelfGroupList = new ByteArrayFilterGroupList();

private final StringFilterGroup howThisWasMadeSection;
private final StringFilterGroup infoCardsSection;
private final StringFilterGroup macroMarkerShelf;
private final StringFilterGroup shoppingLinks;

public DescriptionsFilter() {
final StringFilterGroup infoCardsSection = new StringFilterGroup(
Settings.HIDE_INFO_CARDS_SECTION,
"infocards_section.eml"
);

final StringFilterGroup podcastSection = new StringFilterGroup(
Settings.HIDE_PODCAST_SECTION,
"playlist_section.eml"
);

// game section, music section and places section now use the same identifier in the latest version.
final StringFilterGroup attributesSection = new StringFilterGroup(
Settings.HIDE_ATTRIBUTES_SECTION,
Expand All @@ -35,18 +27,32 @@ public DescriptionsFilter() {
"video_attributes_section.eml"
);

final StringFilterGroup podcastSection = new StringFilterGroup(
Settings.HIDE_PODCAST_SECTION,
"playlist_section.eml"
);

final StringFilterGroup transcriptSection = new StringFilterGroup(
Settings.HIDE_TRANSCRIPT_SECTION,
"transcript_section.eml"
);

addIdentifierCallbacks(
attributesSection,
infoCardsSection,
podcastSection,
transcriptSection
);

howThisWasMadeSection = new StringFilterGroup(
Settings.HIDE_CONTENTS_SECTION,
"how_this_was_made_section.eml"
);

infoCardsSection = new StringFilterGroup(
Settings.HIDE_INFO_CARDS_SECTION,
"infocards_section.eml"
);

macroMarkerShelf = new StringFilterGroup(
null,
"macro_markers_carousel.eml"
Expand All @@ -59,6 +65,8 @@ public DescriptionsFilter() {
);

addPathCallbacks(
howThisWasMadeSection,
infoCardsSection,
macroMarkerShelf,
shoppingLinks
);
Expand All @@ -79,7 +87,7 @@ public DescriptionsFilter() {
public boolean isFiltered(String path, @Nullable String identifier, String allValue, byte[] protobufBufferArray,
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
// Check for the index because of likelihood of false positives.
if (matchedGroup == shoppingLinks) {
if (matchedGroup == howThisWasMadeSection || matchedGroup == infoCardsSection || matchedGroup == shoppingLinks) {
if (contentIndex != 0) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting DISABLE_ROLLING_NUMBER_ANIMATIONS = new BooleanSetting("revanced_disable_rolling_number_animations", 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", FALSE);
public static final BooleanSetting HIDE_CONTENTS_SECTION = new BooleanSetting("revanced_hide_contents_section", FALSE);
public static final BooleanSetting HIDE_INFO_CARDS_SECTION = new BooleanSetting("revanced_hide_info_cards_section", FALSE);
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", FALSE);
Expand Down

0 comments on commit 8cf8fc8

Please sign in to comment.