From 628ae1172139b5cecbcd1485ab89d1bd529020d5 Mon Sep 17 00:00:00 2001
From: inotia00 <108592928+inotia00@users.noreply.github.com>
Date: Sat, 11 Nov 2023 23:38:59 +0900
Subject: [PATCH] feat(YouTube/Hide layout components): add `Hide videos with
low views` settings
---
.../youtube/general/layout/LayoutComponentsPatch.kt | 1 +
.../kotlin/app/revanced/util/resources/ResourceHelper.kt | 8 ++++----
.../resources/youtube/settings/host/values/strings.xml | 3 +++
.../resources/youtube/settings/xml/revanced_prefs.xml | 4 +++-
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/layout/LayoutComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/layout/LayoutComponentsPatch.kt
index a3920e936..0d6d9db4c 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/general/layout/LayoutComponentsPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/general/layout/LayoutComponentsPatch.kt
@@ -47,6 +47,7 @@ object LayoutComponentsPatch : BytecodePatch() {
LithoFilterPatch.addFilter("$COMPONENTS_PATH/CommunityPostFilter;")
LithoFilterPatch.addFilter("$COMPONENTS_PATH/LayoutComponentsFilter;")
LithoFilterPatch.addFilter("$COMPONENTS_PATH/LayoutComponentsUniversalFilter;")
+ LithoFilterPatch.addFilter("$COMPONENTS_PATH/LowViewsFilter;")
/**
* Add settings
diff --git a/src/main/kotlin/app/revanced/util/resources/ResourceHelper.kt b/src/main/kotlin/app/revanced/util/resources/ResourceHelper.kt
index 8de3c99e9..8d4d9cb68 100644
--- a/src/main/kotlin/app/revanced/util/resources/ResourceHelper.kt
+++ b/src/main/kotlin/app/revanced/util/resources/ResourceHelper.kt
@@ -70,14 +70,14 @@ internal object ResourceHelper {
updatePatchStatusSettings("Header", headerName)
}
- internal fun ResourceContext.updatePatchStatusLabel(appName: String) {
- updatePatchStatusSettings("Label", appName)
- }
-
internal fun ResourceContext.updatePatchStatusIcon(iconName: String) {
updatePatchStatusSettings("Icon", "@string/revanced_icon_$iconName")
}
+ internal fun ResourceContext.updatePatchStatusLabel(appName: String) {
+ updatePatchStatusSettings("Label", appName)
+ }
+
internal fun ResourceContext.updatePatchStatusTheme(themeName: String) {
updatePatchStatusSettings("Theme", themeName)
}
diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml
index 3a6207c7f..096047a46 100644
--- a/src/main/resources/youtube/settings/host/values/strings.xml
+++ b/src/main/resources/youtube/settings/host/values/strings.xml
@@ -587,6 +587,9 @@ Known issue: Autoplay does not work."
Video ads are shown.
Video ads are hidden.
Hide video ads
+ "Hide videos with less than 1,000 views exposed to the home feed.
+Some videos, including those from channels you subscribe to, may not be hidden even if they have fewer than 1,000 views."
+ Hide videos with low views
View products banner is shown.
View products banner is hidden.
Hide view products banner
diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
index 2ba4fcf61..ae6ef4342 100644
--- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml
+++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
@@ -245,7 +245,9 @@
- SETTINGS: HIDE_LAYOUT_COMPONENTS -->
+
+
+ SETTINGS: HIDE_LAYOUT_COMPONENTS -->