Skip to content

Commit

Permalink
refactor: move code into HideLayoutComponents
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Mar 8, 2024
1 parent b8858f7 commit 9cd5a63
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 75 deletions.
6 changes: 0 additions & 6 deletions api/revanced-patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -1350,12 +1350,6 @@ public final class app/revanced/patches/youtube/layout/hide/infocards/HideInfoca
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}

public final class app/revanced/patches/youtube/layout/hide/keyword/HideKeywordContentPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/hide/keyword/HideKeywordContentPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}

public final class app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ object HideLayoutComponentsPatch : BytecodePatch(
"Lapp/revanced/integrations/youtube/patches/components/DescriptionComponentsFilter;"
private const val CUSTOM_FILTER_CLASS_NAME =
"Lapp/revanced/integrations/youtube/patches/components/CustomFilter;"
private const val KEYWORD_FILTER_CLASS_NAME =
"Lapp/revanced/integrations/youtube/patches/components/HideKeywordContentFilter;"

override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)
Expand Down Expand Up @@ -113,6 +115,16 @@ object HideLayoutComponentsPatch : BytecodePatch(
SwitchPreference("revanced_hide_search_result_shelf_header"),
)

SettingsPatch.PreferenceScreen.FEED.addPreferences(
PreferenceScreen(
key = "revanced_hide_keyword_content_preference_screen",
preferences = setOf(
SwitchPreference("revanced_hide_keyword_content"),
TextPreference("revanced_hide_keyword_content_phrases", inputType = InputType.TEXT_MULTI_LINE),
),
)
)

SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences(
SwitchPreference("revanced_hide_gray_separator"),
PreferenceScreen(
Expand All @@ -132,6 +144,7 @@ object HideLayoutComponentsPatch : BytecodePatch(

LithoFilterPatch.addFilter(LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR)
LithoFilterPatch.addFilter(DESCRIPTION_COMPONENTS_FILTER_CLASS_NAME)
LithoFilterPatch.addFilter(KEYWORD_FILTER_CLASS_NAME)
LithoFilterPatch.addFilter(CUSTOM_FILTER_CLASS_NAME)

// region Mix playlists
Expand Down

This file was deleted.

22 changes: 10 additions & 12 deletions src/main/resources/addresources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@
<string name="revanced_custom_filter_toast_invalid_characters">Invalid custom filter (must be ASCII only): %s</string>
<string name="revanced_custom_filter_toast_invalid_syntax">Invalid custom filter: %s</string>
<string name="revanced_custom_filter_toast_reset">Custom filter reset to default</string>
<string name="revanced_hide_keyword_content_preference_screen_title">Hide keyword content</string>
<string name="revanced_hide_keyword_content_preference_screen_summary">Hide feed and search result videos using keyword filters</string>
<string name="revanced_hide_keyword_content_title">Enable keyword filtering</string>
<string name="revanced_hide_keyword_content_summary_on">Feed/search is filtered to hide content that matches keyword phrases\n\nLimitations\n• Some UI elements may not be hidden\n• Some Shorts may not be hidden\n• Searching for a keyword may show no results</string>
<string name="revanced_hide_keyword_content_summary_off">Feed/search results are not filtered</string>
<string name="revanced_hide_keyword_content_phrases_title">Keywords to hide</string>
<string name="revanced_hide_keyword_content_phrases_summary">Keywords and phrases to hide, separated by new lines.\n\nText specified here automatically include some uppercase and lowercase variations, but some text requires entering the exact casing (ie: LeBlanc, John Doe, etc)</string>
<string name="revanced_hide_keyword_toast_invalid_characters" formatted="false">Invalid keyword phrase (must be ASCII only): %s</string>
<string name="revanced_hide_keyword_toast_invalid_length" formatted="false">Invalid keyword length (must be at least %s characters): %s</string>
<string name="revanced_hide_keyword_toast_reset">Keywords reset to default</string>
</patch>
<patch id="ad.general.HideAdsResourcePatch">
<string name="revanced_hide_general_ads_title">Hide general ads</string>
Expand Down Expand Up @@ -431,18 +441,6 @@
<string name="revanced_hide_floating_microphone_button_summary_on">Microphone button hidden</string>
<string name="revanced_hide_floating_microphone_button_summary_off">Microphone button shown</string>
</patch>
<patch id="layout.hide.keyword.HideKeywordContentPatch">
<string name="revanced_hide_keyword_content_preference_screen_title">Hide keyword content</string>
<string name="revanced_hide_keyword_content_preference_screen_summary">Hide home/search result videos with keyword filters</string>
<string name="revanced_hide_keyword_content_title">Enable keyword filtering</string>
<string name="revanced_hide_keyword_content_summary_on">Home/search is filtered to hide content matching keyword phrases\n\nLimitations\n• Some UI elements may not be hidden\n• Searching for a keyword may give no search results\n• Some Shorts may not be hidden</string>
<string name="revanced_hide_keyword_content_summary_off">Home/search results are not filtered</string>
<string name="revanced_hide_keyword_content_phrases_title">Keywords to hide</string>
<string name="revanced_hide_keyword_content_phrases_summary">Keyword and phrases to hide, separated by new lines\n\nKeywords specified here automatically include some uppercase and lowercase variations, but some keywords require entering the exact casing (ie: \'LeBlanc\', \'Van Der Berg\', etc)</string>
<string name="revanced_hide_keyword_toast_invalid_characters" formatted="false">Invalid keyword phrase (must be ASCII only): %s</string>
<string name="revanced_hide_keyword_toast_invalid_length" formatted="false">Invalid keyword length (must be at least %s characters): %s</string>
<string name="revanced_hide_keyword_toast_reset">Keywords reset to default</string>
</patch>
<patch id="layout.hide.fullscreenambientmode.DisableFullscreenAmbientModePatch">
<string name="revanced_disable_fullscreen_ambient_mode_title">Disable ambient mode in fullscreen</string>
<string name="revanced_disable_fullscreen_ambient_mode_summary_on">Ambient mode disabled</string>
Expand Down

0 comments on commit 9cd5a63

Please sign in to comment.