diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/descriptions/patch/DescriptionComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/descriptions/patch/DescriptionComponentsPatch.kt new file mode 100644 index 000000000..514403bf8 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/general/descriptions/patch/DescriptionComponentsPatch.kt @@ -0,0 +1,49 @@ +package app.revanced.patches.youtube.descriptions.layout.patch + +import app.revanced.patcher.annotation.Description +import app.revanced.patcher.annotation.Name +import app.revanced.patcher.annotation.Version +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.PatchResult +import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch +import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch +import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus +import app.revanced.util.integrations.Constants.PATCHES_PATH + +@Patch +@Name("hide-description-components") +@Description("Hides description components.") +@DependsOn( + [ + LithoFilterPatch::class, + SettingsPatch::class + ] +) +@YouTubeCompatibility +@Version("0.0.1") +class DescriptionComponentsPatch : BytecodePatch() { + override fun execute(context: BytecodeContext): PatchResult { + LithoFilterPatch.addFilter("$PATCHES_PATH/ads/DescriptionsFilter;") + + /** + * Add settings + */ + SettingsPatch.addPreference( + arrayOf( + "PREFERENCE: GENERAL_SETTINGS", + "SETTINGS: HIDE_DESCRIPTION_COMPONENTS" + ) + ) + + SettingsPatch.updatePatchStatus("hide-description-components") + + context.updatePatchStatus("DescriptionComponent") + + return PatchResultSuccess() + } +} diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index 8b029d784..6ce73968b 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -31,6 +31,7 @@ Default video quality on Mobile network Default video quality on Wi-Fi network Default video speed + Description Forced auto captions are enabled Forced auto captions are disabled Disable forced auto captions @@ -240,7 +241,7 @@ Hide channel watermark Chapters are shown Chapters are hidden - Hide chapters in the video description + Hide chapters Collapse button is shown Collapse button is hidden Hide collapse button @@ -338,6 +339,9 @@ Movies shelves are shown Movies shelves are hidden Hide movies shelf + Music sections are shown + Music sections are hidden + Hide music sections Navigation label is shown Navigation label is hidden Hide navigation label @@ -347,6 +351,9 @@ Paid promotion banner is shown Paid promotion banner is hidden Hide paid promotion banner + Place sections are shown + Place sections are hidden + Hide place sections Player button background is shown Player button background is hidden Hide player button background @@ -472,6 +479,9 @@ Only available on YouTube v18.24.37+" Time stamp is shown Time stamp is hidden Hide time stamp + Transcript sections are shown + Transcript sections are hidden + Hide transcript sections Trending searches are shown Trending searches are hidden Hide trending searches diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 925e30a8a..eaf0072c9 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -187,7 +187,6 @@ - @@ -203,6 +202,13 @@ SETTINGS: HIDE_LAYOUT_COMPONENTS --> + + @@ -306,6 +312,7 @@ +