mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-12-03 17:22:54 +01:00
feat(YouTube - Hide layout components): Hide description components
This commit is contained in:
parent
0978e64655
commit
726a2510a5
@ -0,0 +1,69 @@
|
|||||||
|
package app.revanced.integrations.patches.components;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import app.revanced.integrations.settings.SettingsEnum;
|
||||||
|
import app.revanced.integrations.utils.StringTrieSearch;
|
||||||
|
|
||||||
|
final class DescriptionComponentsFilter extends Filter {
|
||||||
|
|
||||||
|
private final StringTrieSearch exceptions = new StringTrieSearch();
|
||||||
|
|
||||||
|
public DescriptionComponentsFilter() {
|
||||||
|
exceptions.addPatterns(
|
||||||
|
"compact_channel",
|
||||||
|
"description",
|
||||||
|
"grid_video",
|
||||||
|
"inline_expander",
|
||||||
|
"metadata"
|
||||||
|
);
|
||||||
|
|
||||||
|
final StringFilterGroup chapterSection = new StringFilterGroup(
|
||||||
|
SettingsEnum.HIDE_CHAPTERS,
|
||||||
|
"macro_markers_carousel"
|
||||||
|
);
|
||||||
|
|
||||||
|
final StringFilterGroup infoCardsSection = new StringFilterGroup(
|
||||||
|
SettingsEnum.HIDE_INFO_CARDS_SECTION,
|
||||||
|
"infocards_section"
|
||||||
|
);
|
||||||
|
|
||||||
|
final StringFilterGroup gameSection = new StringFilterGroup(
|
||||||
|
SettingsEnum.HIDE_GAME_SECTION,
|
||||||
|
"gaming_section"
|
||||||
|
);
|
||||||
|
|
||||||
|
final StringFilterGroup musicSection = new StringFilterGroup(
|
||||||
|
SettingsEnum.HIDE_MUSIC_SECTION,
|
||||||
|
"music_section",
|
||||||
|
"video_attributes_section"
|
||||||
|
);
|
||||||
|
|
||||||
|
final StringFilterGroup podcastSection = new StringFilterGroup(
|
||||||
|
SettingsEnum.HIDE_PODCAST_SECTION,
|
||||||
|
"playlist_section"
|
||||||
|
);
|
||||||
|
|
||||||
|
final StringFilterGroup transcriptSection = new StringFilterGroup(
|
||||||
|
SettingsEnum.HIDE_TRANSCIPT_SECTION,
|
||||||
|
"transcript_section"
|
||||||
|
);
|
||||||
|
|
||||||
|
pathFilterGroupList.addAll(
|
||||||
|
chapterSection,
|
||||||
|
infoCardsSection,
|
||||||
|
gameSection,
|
||||||
|
musicSection,
|
||||||
|
podcastSection,
|
||||||
|
transcriptSection
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||||
|
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||||
|
if (exceptions.matches(path)) return false;
|
||||||
|
|
||||||
|
return super.isFiltered(path, identifier, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
|
||||||
|
}
|
||||||
|
}
|
@ -136,11 +136,6 @@ public final class LayoutComponentsFilter extends Filter {
|
|||||||
"quality_sheet_footer"
|
"quality_sheet_footer"
|
||||||
);
|
);
|
||||||
|
|
||||||
final var chapters = new StringFilterGroup(
|
|
||||||
SettingsEnum.HIDE_CHAPTERS,
|
|
||||||
"macro_markers_carousel"
|
|
||||||
);
|
|
||||||
|
|
||||||
final var channelBar = new StringFilterGroup(
|
final var channelBar = new StringFilterGroup(
|
||||||
SettingsEnum.HIDE_CHANNEL_BAR,
|
SettingsEnum.HIDE_CHANNEL_BAR,
|
||||||
"channel_bar"
|
"channel_bar"
|
||||||
@ -226,8 +221,7 @@ public final class LayoutComponentsFilter extends Filter {
|
|||||||
|
|
||||||
this.identifierFilterGroupList.addAll(
|
this.identifierFilterGroupList.addAll(
|
||||||
graySeparator,
|
graySeparator,
|
||||||
chipsShelf,
|
chipsShelf
|
||||||
chapters
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +243,6 @@ public final class LayoutComponentsFilter extends Filter {
|
|||||||
return super.isFiltered(identifier, path, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
|
return super.isFiltered(identifier, path, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injection point.
|
* Injection point.
|
||||||
* Called from a different place then the other filters.
|
* Called from a different place then the other filters.
|
||||||
|
@ -72,7 +72,6 @@ public enum SettingsEnum {
|
|||||||
HIDE_CAST_BUTTON("revanced_hide_cast_button", BOOLEAN, TRUE, true),
|
HIDE_CAST_BUTTON("revanced_hide_cast_button", BOOLEAN, TRUE, true),
|
||||||
HIDE_CHANNEL_BAR("revanced_hide_channel_bar", BOOLEAN, FALSE),
|
HIDE_CHANNEL_BAR("revanced_hide_channel_bar", BOOLEAN, FALSE),
|
||||||
HIDE_CHANNEL_MEMBER_SHELF("revanced_hide_channel_member_shelf", BOOLEAN, TRUE),
|
HIDE_CHANNEL_MEMBER_SHELF("revanced_hide_channel_member_shelf", BOOLEAN, TRUE),
|
||||||
HIDE_CHAPTERS("revanced_hide_chapters", BOOLEAN, TRUE),
|
|
||||||
HIDE_CHIPS_SHELF("revanced_hide_chips_shelf", BOOLEAN, TRUE),
|
HIDE_CHIPS_SHELF("revanced_hide_chips_shelf", BOOLEAN, TRUE),
|
||||||
HIDE_COMMENTS_SECTION("revanced_hide_comments_section", BOOLEAN, FALSE, true),
|
HIDE_COMMENTS_SECTION("revanced_hide_comments_section", BOOLEAN, FALSE, true),
|
||||||
HIDE_COMMUNITY_GUIDELINES("revanced_hide_community_guidelines", BOOLEAN, TRUE),
|
HIDE_COMMUNITY_GUIDELINES("revanced_hide_community_guidelines", BOOLEAN, TRUE),
|
||||||
@ -123,6 +122,13 @@ public enum SettingsEnum {
|
|||||||
TABLET_LAYOUT("revanced_tablet_layout", BOOLEAN, FALSE, true, "revanced_tablet_layout_user_dialog_message"),
|
TABLET_LAYOUT("revanced_tablet_layout", BOOLEAN, FALSE, true, "revanced_tablet_layout_user_dialog_message"),
|
||||||
USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", BOOLEAN, FALSE, true),
|
USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", BOOLEAN, FALSE, true),
|
||||||
WIDE_SEARCHBAR("revanced_wide_searchbar", BOOLEAN, FALSE, true),
|
WIDE_SEARCHBAR("revanced_wide_searchbar", BOOLEAN, FALSE, true),
|
||||||
|
// Description
|
||||||
|
HIDE_CHAPTERS("revanced_hide_chapters", BOOLEAN, TRUE),
|
||||||
|
HIDE_INFO_CARDS_SECTION("revanced_hide_info_cards_section", BOOLEAN, TRUE),
|
||||||
|
HIDE_GAME_SECTION("revanced_hide_game_section", BOOLEAN, TRUE),
|
||||||
|
HIDE_MUSIC_SECTION("revanced_hide_music_section", BOOLEAN, TRUE),
|
||||||
|
HIDE_PODCAST_SECTION("revanced_hide_podcast_section", BOOLEAN, TRUE),
|
||||||
|
HIDE_TRANSCIPT_SECTION("revanced_hide_transcript_section", BOOLEAN, TRUE),
|
||||||
|
|
||||||
// Shorts
|
// Shorts
|
||||||
HIDE_SHORTS("revanced_hide_shorts", BOOLEAN, FALSE, true),
|
HIDE_SHORTS("revanced_hide_shorts", BOOLEAN, FALSE, true),
|
||||||
|
Loading…
Reference in New Issue
Block a user