From 3993128405d52659299b81385646f6643aa4499b Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sat, 18 Nov 2023 02:17:46 +0900 Subject: [PATCH] feat(YouTube): separate the `Hide channel profile components` patch from `Hide layout components` patch --- .../ChannelProfileComponentsPatch.kt | 63 +++++++++++++++++++ .../general/layout/LayoutComponentsPatch.kt | 1 - .../youtube/settings/xml/revanced_prefs.xml | 9 ++- 3 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 src/main/kotlin/app/revanced/patches/youtube/general/channelprofile/ChannelProfileComponentsPatch.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/channelprofile/ChannelProfileComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/channelprofile/ChannelProfileComponentsPatch.kt new file mode 100644 index 000000000..b3a030c42 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/general/channelprofile/ChannelProfileComponentsPatch.kt @@ -0,0 +1,63 @@ +package app.revanced.patches.youtube.general.descriptions + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.youtube.utils.litho.LithoFilterPatch +import app.revanced.patches.youtube.utils.settings.SettingsPatch +import app.revanced.util.integrations.Constants.COMPONENTS_PATH + +@Patch( + name = "Hide channel profile components", + description = "Hides channel profile components.", + dependencies = [ + LithoFilterPatch::class, + SettingsPatch::class + ], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.youtube", + [ + "18.25.40", + "18.27.36", + "18.29.38", + "18.30.37", + "18.31.40", + "18.32.39", + "18.33.40", + "18.34.38", + "18.35.36", + "18.36.39", + "18.37.36", + "18.38.44", + "18.39.41", + "18.40.34", + "18.41.39", + "18.42.41", + "18.43.45", + "18.44.41", + "18.45.38" + ] + ) + ] +) +@Suppress("unused") +object ChannelProfileComponentsPatch : BytecodePatch() { + override fun execute(context: BytecodeContext) { + LithoFilterPatch.addFilter("$COMPONENTS_PATH/ChannelProfileFilter;") + + /** + * Add settings + */ + SettingsPatch.addPreference( + arrayOf( + "PREFERENCE: GENERAL_SETTINGS", + "SETTINGS: HIDE_CHANNEL_PROFILE_COMPONENTS" + ) + ) + + SettingsPatch.updatePatchStatus("Hide channel profile components") + + } +} 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 e2932330d..338b834f7 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 @@ -45,7 +45,6 @@ import app.revanced.util.integrations.Constants.COMPONENTS_PATH @Suppress("unused") object LayoutComponentsPatch : BytecodePatch() { override fun execute(context: BytecodeContext) { - LithoFilterPatch.addFilter("$COMPONENTS_PATH/BrowseStoreButtonFilter;") LithoFilterPatch.addFilter("$COMPONENTS_PATH/CommunityPostFilter;") LithoFilterPatch.addFilter("$COMPONENTS_PATH/LayoutComponentsFilter;") LithoFilterPatch.addFilter("$COMPONENTS_PATH/LayoutComponentsUniversalFilter;") diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 69e2c61a4..3837b9ad4 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -228,9 +228,6 @@ - - - @@ -249,6 +246,12 @@ SETTINGS: HIDE_LAYOUT_COMPONENTS --> + +