From 6c94839b262ae919da3760510eb9a43bb4dad42a Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 28 Aug 2024 03:36:30 -0400 Subject: [PATCH 1/8] feat(YouTube - Keyword filter): Remove keyword minimum length. Match whole keywords and not substrings. --- src/main/resources/addresources/values/strings.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index a696e7a4ba..fa9c6092ca 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -248,9 +248,7 @@ This is because Crowdin requires temporarily flattening this file and removing t 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 - Invalid keyword. Cannot use: \'%s\' as a filter - - Invalid keyword. \'%1$s\' is less than %2$d characters + Cannot use: \'%s\' as a keyword Keyword \'%s\' will hide all videos From d982bc0cc0c9d2cc284f7d8348af452addeb48da Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:19:44 -0400 Subject: [PATCH 2/8] fix: Mention partial matches are not hidden. Break apart 'about' preference into two sections to reduce text clipping of translations --- .../hide/general/HideLayoutComponentsPatch.kt | 1 + src/main/resources/addresources/values/strings.xml | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 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..1966c057e3 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,6 +138,7 @@ 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("revanced_hide_keyword_content_limitations"), ), ), ) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index fa9c6092ca..8747d410aa 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -243,13 +243,16 @@ This is because Crowdin requires temporarily flattening this file and removing t Search results are not filtered by keywords 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) + This is because keywords can be in any language, and showing an example in the localized script helps convey this. + Do not translate using 'fox' or 'foxes'. Instead use a localized pair of words where the first keyword is a substring of the second (and both words refer to the same thing/idea). If the language does not have any examples of this (such as some pictographic languages) then do not include that info in the translation. --> + 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)\n\nVideo with partial word matches are not hidden and some keywords may need additional variations (ie: if adding keyword \'fox\' then also add \'foxes\') 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\nKeywords can be a channel name or any text shown in video titles + Limitations + • Some Shorts may not be hidden\n• Some UI components may not be hidden\n• Searching for a keyword may show no results - Cannot use: \'%s\' as a keyword - Keyword \'%s\' will hide all videos + Cannot use keyword: \'%s\' + Keyword will hide all videos: \'%s\' Hide general ads From 79a3a6312f31ad038370be448bfa7bd00a13824f Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 28 Aug 2024 22:11:36 -0400 Subject: [PATCH 3/8] fix: Add a toggle to enable/disable whole word matching --- .../hide/general/HideLayoutComponentsPatch.kt | 2 +- src/main/resources/addresources/values/strings.xml | 13 +++++++------ 2 files changed, 8 insertions(+), 7 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 1966c057e3..cf00e6762f 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 @@ -136,9 +136,9 @@ object HideLayoutComponentsPatch : BytecodePatch( SwitchPreference("revanced_hide_keyword_content_home"), SwitchPreference("revanced_hide_keyword_content_subscriptions"), SwitchPreference("revanced_hide_keyword_content_search"), + SwitchPreference("revanced_hide_keyword_content_whole_word"), TextPreference("revanced_hide_keyword_content_phrases", inputType = InputType.TEXT_MULTI_LINE), NonInteractivePreference("revanced_hide_keyword_content_about"), - NonInteractivePreference("revanced_hide_keyword_content_limitations"), ), ), ) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index 8747d410aa..0ea0a8eb65 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -241,18 +241,19 @@ This is because Crowdin requires temporarily flattening this file and removing t Hide search results by keywords Search results are filtered by keywords Search results are not filtered by keywords + Match whole keywords + Videos with partial keyword matches are not hidden + Videos with partial keyword matches are hidden 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)\n\nVideo with partial word matches are not hidden and some keywords may need additional variations (ie: if adding keyword \'fox\' then also add \'foxes\') + This is because keywords can be in any language, and showing an example in the localized script helps convey this. --> + 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\nKeywords can be a channel name or any text shown in video titles - Limitations - • 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• Some Shorts may not be hidden\n• Some UI components may not be hidden\n• Searching for a keyword may show no results Cannot use keyword: \'%s\' Keyword will hide all videos: \'%s\' + \'%1$s\' is too short and requires enabling \'Match full word\' Hide general ads From 9c3cbef1e563359203aaf28d0b93d55c941ec669 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 28 Aug 2024 22:46:26 -0400 Subject: [PATCH 4/8] fix: Shorts cannot be hidden by channel name --- src/main/resources/addresources/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index 0ea0a8eb65..bd686b57e7 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -249,7 +249,7 @@ This is because Crowdin requires temporarily flattening this file and removing t This is because keywords can be in any language, and showing an example in the localized script helps convey this. --> 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 Cannot use keyword: \'%s\' Keyword will hide all videos: \'%s\' From f88831884c99daa04938eaf0455c7f7fab2b4bb1 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:43:15 -0400 Subject: [PATCH 5/8] fix: Use whole word syntax --- .../layout/hide/general/HideLayoutComponentsPatch.kt | 7 ++++--- src/main/resources/addresources/values/strings.xml | 9 +++++---- 2 files changed, 9 insertions(+), 7 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 cf00e6762f..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 @@ -136,11 +136,12 @@ object HideLayoutComponentsPatch : BytecodePatch( SwitchPreference("revanced_hide_keyword_content_home"), SwitchPreference("revanced_hide_keyword_content_subscriptions"), SwitchPreference("revanced_hide_keyword_content_search"), - SwitchPreference("revanced_hide_keyword_content_whole_word"), 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 bd686b57e7..6d584d86ae 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -241,19 +241,20 @@ This is because Crowdin requires temporarily flattening this file and removing t Hide search results by keywords Search results are filtered by keywords Search results are not filtered by keywords - Match whole keywords - Videos with partial keyword matches are not hidden - Videos with partial keyword matches are hidden Keywords to hide 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• 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 + Surround a keyword/phrase with quotes, and video titles with partial matches will not be hidden<br><br>For example,<br><b>\"ai\"</b> will hide the video: <b>Is AI dumb?</b><br>but will not hide: <b>DMCA fair use explained!</b> Cannot use keyword: \'%s\' + Add quotes to use keyword: \'%s\' + Keyword has conflicting declarations: \'%s\' + \'%1$s\' is too short and requires quotes Keyword will hide all videos: \'%s\' - \'%1$s\' is too short and requires enabling \'Match full word\' Hide general ads From 82364c111accca63fec6d3766d7102105f809d73 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:30:45 -0400 Subject: [PATCH 6/8] fix: Adjust settings text --- src/main/resources/addresources/values/strings.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index 6d584d86ae..cd07f1523a 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -248,7 +248,8 @@ This is because Crowdin requires temporarily flattening this file and removing t About keyword filtering 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 - Surround a keyword/phrase with quotes, and video titles with partial matches will not be hidden<br><br>For example,<br><b>\"ai\"</b> will hide the video: <b>Is AI dumb?</b><br>but will not hide: <b>DMCA fair use explained!</b> + + 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>Is AI dumb?</b><br>but will not hide: <b>DMCA fair use explained!</b> Cannot use keyword: \'%s\' Add quotes to use keyword: \'%s\' From 328279af5f2d171662a1aae76b7450a979a7725b Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:53:07 -0400 Subject: [PATCH 7/8] fix: Adjust settings text --- src/main/resources/addresources/values/strings.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index cd07f1523a..af87af155f 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -249,13 +249,13 @@ This is because Crowdin requires temporarily flattening this file and removing t 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>Is AI dumb?</b><br>but will not hide: <b>DMCA fair use explained!</b> + 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>Is AI dumb?</b><br>but will not hide: <b>What does fair use mean?</b> - Cannot use keyword: \'%s\' - Add quotes to use keyword: \'%s\' - Keyword has conflicting declarations: \'%s\' - \'%1$s\' is too short and requires quotes - Keyword will hide all videos: \'%s\' + 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 From 86ec48ca782f5c13326551cdc2ae10e4800184a9 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Fri, 30 Aug 2024 15:58:47 -0400 Subject: [PATCH 8/8] fix: Adjust settings text --- src/main/resources/addresources/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index af87af155f..8b48e2fc2b 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -248,8 +248,8 @@ This is because Crowdin requires temporarily flattening this file and removing t About keyword filtering 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>Is AI dumb?</b><br>but will not hide: <b>What does fair use mean?</b> + + 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> Cannot use keyword: %s Add quotes to use keyword: %s