From f5fb3512cfafe214ba6a6d25ba0825ae1884a0ff Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Fri, 30 Aug 2024 17:38:59 -0400 Subject: [PATCH] feat(YouTube - Keyword filter): Add syntax to match whole keywords and not substrings (#3592) --- .../hide/general/HideLayoutComponentsPatch.kt | 6 ++++-- .../resources/addresources/values/strings.xml | 16 ++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt index 66e025790e..bff904da08 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt @@ -138,8 +138,10 @@ object HideLayoutComponentsPatch : BytecodePatch( SwitchPreference("revanced_hide_keyword_content_search"), TextPreference("revanced_hide_keyword_content_phrases", inputType = InputType.TEXT_MULTI_LINE), NonInteractivePreference("revanced_hide_keyword_content_about"), - ), - ), + NonInteractivePreference(key = "revanced_hide_keyword_content_about_whole_words", + tag = "app.revanced.integrations.youtube.settings.preference.HtmlPreference") + ) + ) ) SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences( diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index a696e7a4ba..8b48e2fc2b 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -244,14 +244,18 @@ This is because Crowdin requires temporarily flattening this file and removing t Keywords to hide - Keywords and phrases to hide, separated by new lines\n\nWords with uppercase letters in the middle must be entered with the casing (ie: iPhone, TikTok, LeBlanc) + Keywords and phrases to hide, separated by new lines\n\nKeywords can be channel names or any text shown in video titles\n\nWords with uppercase letters in the middle must be entered with the casing (ie: iPhone, TikTok, LeBlanc) About keyword filtering - Home/Subscription/Search results are filtered to hide content that matches keyword phrases\n\nLimitations\n• Some Shorts may not be hidden\n• Some UI components may not be hidden\n• Searching for a keyword may show no results + Home/Subscription/Search results are filtered to hide content that matches keyword phrases\n\nLimitations\n• Shorts cannot be hidden by channel name\n• Some UI components may not be hidden\n• Searching for a keyword may show no results + Match whole words + + Surrounding a keyword/phrase with double-quotes will prevent partial matches of video titles and channel names<br><br>For example,<br><b>\"ai\"</b> will hide the video: <b>How does AI work?</b><br>but will not hide: <b>What does fair use mean?</b> - Invalid keyword. Cannot use: \'%s\' as a filter - - Invalid keyword. \'%1$s\' is less than %2$d characters - Keyword \'%s\' will hide all videos + Cannot use keyword: %s + Add quotes to use keyword: %s + Keyword has conflicting declarations: %s + Keyword is too short and requires quotes: %s + Keyword will hide all videos: %s Hide general ads