From bbcb57a32dfc8f031886f98b1b9701285105c579 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Tue, 22 Oct 2024 18:29:23 -0400 Subject: [PATCH] feat(YouTube): Merge multiple layout patches into `Hide Layout Components` (#3799) --- .../layout/hide/albumcards/AlbumCardsPatch.kt | 53 +----- .../albumcards/AlbumCardsResourcePatch.kt | 30 --- .../layout/hide/comments/CommentsPatch.kt | 60 +----- .../crowdfundingbox/CrowdfundingBoxPatch.kt | 48 +---- .../CrowdfundingBoxResourcePatch.kt | 33 ---- .../hide/filterbar/HideFilterBarPatch.kt | 88 +-------- .../filterbar/HideFilterBarResourcePatch.kt | 36 ---- .../HideFloatingMicrophoneButtonPatch.kt | 51 +---- ...deFloatingMicrophoneButtonResourcePatch.kt | 30 --- .../hide/general/HideLayoutComponentsPatch.kt | 178 +++++++++++++++--- .../HideLayoutComponentsResourcePatch.kt | 41 +++- .../fingerprints/AlbumCardsFingerprint.kt | 6 +- .../CrowdfundingBoxFingerprint.kt | 6 +- .../FilterBarHeightFingerprint.kt | 6 +- .../RelatedChipCloudFingerprint.kt | 6 +- .../SearchResultsChipBarFingerprint.kt | 6 +- ...ShowFloatingMicrophoneButtonFingerprint.kt | 6 +- .../resources/addresources/values/strings.xml | 92 +++++---- 18 files changed, 283 insertions(+), 493 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt rename src/main/kotlin/app/revanced/patches/youtube/layout/hide/{albumcards => general}/fingerprints/AlbumCardsFingerprint.kt (69%) rename src/main/kotlin/app/revanced/patches/youtube/layout/hide/{crowdfundingbox => general}/fingerprints/CrowdfundingBoxFingerprint.kt (65%) rename src/main/kotlin/app/revanced/patches/youtube/layout/hide/{filterbar => general}/fingerprints/FilterBarHeightFingerprint.kt (67%) rename src/main/kotlin/app/revanced/patches/youtube/layout/hide/{filterbar => general}/fingerprints/RelatedChipCloudFingerprint.kt (65%) rename src/main/kotlin/app/revanced/patches/youtube/layout/hide/{filterbar => general}/fingerprints/SearchResultsChipBarFingerprint.kt (68%) rename src/main/kotlin/app/revanced/patches/youtube/layout/hide/{floatingmicrophone => general}/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt (64%) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt index 937f2b509d..7d79a66ef6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt @@ -1,56 +1,13 @@ package app.revanced.patches.youtube.layout.hide.albumcards -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.InstructionExtensions.addInstruction -import app.revanced.patcher.extensions.InstructionExtensions.getInstruction 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.layout.hide.albumcards.fingerprints.AlbumCardsFingerprint -import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch -import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsPatch -@Patch( - name = "Hide album cards", - description = "Adds an option to hide album cards below artist descriptions.", - dependencies = [ - IntegrationsPatch::class, - AlbumCardsResourcePatch::class - ], - compatiblePackages = [ - CompatiblePackage( - "com.google.android.youtube", - [ - "18.38.44", - "18.49.37", - "19.16.39", - "19.25.37", - "19.34.42", - ] - ) - ] -) +@Deprecated("This patch has been merged to HideLayoutComponentsPatch.") @Suppress("unused") object AlbumCardsPatch : BytecodePatch( - setOf(AlbumCardsFingerprint) + dependencies = setOf(HideLayoutComponentsPatch::class), ) { - override fun execute(context: BytecodeContext) { - AlbumCardsFingerprint.result?.let { - it.mutableMethod.apply { - val checkCastAnchorIndex = it.scanResult.patternScanResult!!.endIndex - val insertIndex = checkCastAnchorIndex + 1 - - val albumCardViewRegister = getInstruction(checkCastAnchorIndex).registerA - - addInstruction( - insertIndex, - "invoke-static {v$albumCardViewRegister}, " + - "Lapp/revanced/integrations/youtube/patches/HideAlbumCardsPatch;" + - "->" + - "hideAlbumCard(Landroid/view/View;)V" - ) - } - } ?: throw AlbumCardsFingerprint.exception - } -} + override fun execute(context: BytecodeContext) { } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt deleted file mode 100644 index e8265b68dc..0000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt +++ /dev/null @@ -1,30 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.albumcards - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.all.misc.resources.AddResourcesPatch -import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch -import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.youtube.misc.settings.SettingsPatch - -@Patch( - dependencies = [ - SettingsPatch::class, - ResourceMappingPatch::class, - AddResourcesPatch::class, - ], -) -internal object AlbumCardsResourcePatch : ResourcePatch() { - internal var albumCardId: Long = -1 - - override fun execute(context: ResourceContext) { - AddResourcesPatch(this::class) - - SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_hide_album_cards"), - ) - - albumCardId = ResourceMappingPatch["layout", "album_card"] - } -} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt index 9c595da663..c9d58438e0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt @@ -2,58 +2,12 @@ package app.revanced.patches.youtube.layout.hide.comments import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.CompatiblePackage -import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.all.misc.resources.AddResourcesPatch -import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen -import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch -import app.revanced.patches.youtube.misc.settings.SettingsPatch +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsPatch -@Patch( - name = "Comments", - description = "Adds options to hide components related to comments.", - dependencies = [ - SettingsPatch::class, - LithoFilterPatch::class, - AddResourcesPatch::class - ], - compatiblePackages = [ - CompatiblePackage( - "com.google.android.youtube", - [ - "18.38.44", - "18.49.37", - "19.16.39", - "19.25.37", - "19.34.42", - ] - ) - ] -) +@Deprecated("This patch has been merged to HideLayoutComponentsPatch.") @Suppress("unused") -object CommentsPatch : ResourcePatch() { - private const val FILTER_CLASS_DESCRIPTOR = - "Lapp/revanced/integrations/youtube/patches/components/CommentsFilter;" - - override fun execute(context: ResourceContext) { - AddResourcesPatch(this::class) - - SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - PreferenceScreen( - "revanced_comments_screen", - preferences = setOf( - SwitchPreference("revanced_hide_comments_by_members_header"), - SwitchPreference("revanced_hide_comments_section"), - SwitchPreference("revanced_hide_comments_create_a_short_button"), - SwitchPreference("revanced_hide_comments_preview_comment"), - SwitchPreference("revanced_hide_comments_thanks_button"), - SwitchPreference("revanced_hide_comments_timestamp_and_emoji_buttons") - ), - sorting = PreferenceScreen.Sorting.UNSORTED - ) - ) - - LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR) - } -} +object CommentsPatch : ResourcePatch( + dependencies = setOf(HideLayoutComponentsPatch::class), +) { + override fun execute(context: ResourceContext) { } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt index e186babd7b..be071179c6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt @@ -1,51 +1,13 @@ package app.revanced.patches.youtube.layout.hide.crowdfundingbox -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.InstructionExtensions.addInstruction -import app.revanced.patcher.extensions.InstructionExtensions.getInstruction 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.layout.hide.crowdfundingbox.fingerprints.CrowdfundingBoxFingerprint -import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch -import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsPatch -@Patch( - name = "Hide crowdfunding box", - description = "Adds an option to hide the crowdfunding box between the player and video description.", - dependencies = [ - IntegrationsPatch::class, - CrowdfundingBoxResourcePatch::class - ], - compatiblePackages = [ - CompatiblePackage( - "com.google.android.youtube", - [ - "18.38.44", - "18.49.37", - "19.16.39", - "19.25.37", - "19.34.42", - ] - ) - ] -) +@Deprecated("This patch has been merged to HideLayoutComponentsPatch.") @Suppress("unused") object CrowdfundingBoxPatch : BytecodePatch( - setOf(CrowdfundingBoxFingerprint) + dependencies = setOf(HideLayoutComponentsPatch::class), ) { - private const val INTEGRATIONS_METHOD_DESCRIPTOR = - "Lapp/revanced/integrations/youtube/patches/HideCrowdfundingBoxPatch;->hideCrowdfundingBox(Landroid/view/View;)V" - - override fun execute(context: BytecodeContext) { - CrowdfundingBoxFingerprint.result?.let { - it.mutableMethod.apply { - val insertIndex = it.scanResult.patternScanResult!!.endIndex - val objectRegister = getInstruction(insertIndex).registerA - - addInstruction(insertIndex, "invoke-static {v$objectRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR") - } - } ?: throw CrowdfundingBoxFingerprint.exception - } -} + override fun execute(context: BytecodeContext) { } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt deleted file mode 100644 index f1763704c9..0000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt +++ /dev/null @@ -1,33 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.crowdfundingbox - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.all.misc.resources.AddResourcesPatch -import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch -import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.youtube.misc.settings.SettingsPatch - -@Patch( - dependencies = [ - SettingsPatch::class, - ResourceMappingPatch::class, - AddResourcesPatch::class, - ], -) -internal object CrowdfundingBoxResourcePatch : ResourcePatch() { - internal var crowdfundingBoxId: Long = -1 - - override fun execute(context: ResourceContext) { - AddResourcesPatch(this::class) - - SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_hide_crowdfunding_box"), - ) - - crowdfundingBoxId = ResourceMappingPatch[ - "layout", - "donation_companion", - ] - } -} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt index 7e4ad51230..c084ea9e86 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt @@ -1,90 +1,12 @@ package app.revanced.patches.youtube.layout.hide.filterbar -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.InstructionExtensions.addInstructions -import app.revanced.patcher.extensions.InstructionExtensions.getInstruction -import app.revanced.patcher.fingerprint.MethodFingerprint 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.layout.hide.filterbar.fingerprints.FilterBarHeightFingerprint -import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.RelatedChipCloudFingerprint -import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.SearchResultsChipBarFingerprint -import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction -import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsPatch -@Patch( - name = "Hide filter bar", - description = "Adds options to hide the category bar at the top of video feeds.", - dependencies = [HideFilterBarResourcePatch::class], - compatiblePackages = [ - CompatiblePackage( - "com.google.android.youtube", - [ - "18.38.44", - "18.49.37", - "19.16.39", - "19.25.37", - "19.34.42", - ] - ) - ] -) -@Suppress("unused") +@Deprecated("This patch class has been merged into HideLayoutComponentsPatch.") object HideFilterBarPatch : BytecodePatch( - setOf( - RelatedChipCloudFingerprint, - SearchResultsChipBarFingerprint, - FilterBarHeightFingerprint - ) + dependencies = setOf(HideLayoutComponentsPatch::class) ) { - private const val INTEGRATIONS_CLASS_DESCRIPTOR = - "Lapp/revanced/integrations/youtube/patches/HideFilterBarPatch;" - - override fun execute(context: BytecodeContext) { - FilterBarHeightFingerprint.patch { register -> - """ - invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInFeed(I)I - move-result v$register - """ - } - - RelatedChipCloudFingerprint.patch(1) { register -> - "invoke-static { v$register }, " + - "$INTEGRATIONS_CLASS_DESCRIPTOR->hideInRelatedVideos(Landroid/view/View;)V" - } - - SearchResultsChipBarFingerprint.patch(-1, -2) { register -> - """ - invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInSearch(I)I - move-result v$register - """ - } - } - - /** - * Patch a [MethodFingerprint] with a given [instructions]. - * - * @param RegisterInstruction The type of instruction to get the register from. - * @param insertIndexOffset The offset to add to the end index of the [MethodFingerprint]. - * @param hookRegisterOffset The offset to add to the register of the hook. - * @param instructions The instructions to add with the register as a parameter. - */ - private fun MethodFingerprint.patch( - insertIndexOffset: Int = 0, - hookRegisterOffset: Int = 0, - instructions: (Int) -> String - ) = - result?.let { - it.mutableMethod.apply { - val endIndex = it.scanResult.patternScanResult!!.endIndex - - val insertIndex = endIndex + insertIndexOffset - val register = - getInstruction(endIndex + hookRegisterOffset).registerA - - addInstructions(insertIndex, instructions(register)) - } - } ?: throw exception -} + override fun execute(context: BytecodeContext) {} +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt deleted file mode 100644 index d49df7a5b4..0000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt +++ /dev/null @@ -1,36 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.filterbar - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.all.misc.resources.AddResourcesPatch -import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch -import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen -import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.youtube.misc.settings.SettingsPatch - -@Patch(dependencies = [SettingsPatch::class, ResourceMappingPatch::class, AddResourcesPatch::class]) -internal object HideFilterBarResourcePatch : ResourcePatch() { - internal var filterBarHeightId = -1L - internal var relatedChipCloudMarginId = -1L - internal var barContainerHeightId = -1L - - override fun execute(context: ResourceContext) { - AddResourcesPatch(this::class) - - SettingsPatch.PreferenceScreen.FEED.addPreferences( - PreferenceScreen( - key = "revanced_hide_filter_bar_screen", - preferences = setOf( - SwitchPreference("revanced_hide_filter_bar_feed_in_feed"), - SwitchPreference("revanced_hide_filter_bar_feed_in_search"), - SwitchPreference("revanced_hide_filter_bar_feed_in_related_videos"), - ), - ), - ) - - relatedChipCloudMarginId = ResourceMappingPatch["layout", "related_chip_cloud_reduced_margins"] - filterBarHeightId = ResourceMappingPatch["dimen", "filter_bar_height"] - barContainerHeightId = ResourceMappingPatch["dimen", "bar_container_height"] - } -} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt index 07b8425727..efdbb84fb7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt @@ -1,54 +1,13 @@ package app.revanced.patches.youtube.layout.hide.floatingmicrophone -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.InstructionExtensions.addInstructions -import app.revanced.patcher.extensions.InstructionExtensions.getInstruction 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.layout.hide.floatingmicrophone.fingerprints.ShowFloatingMicrophoneButtonFingerprint -import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsPatch -@Patch( - name = "Hide floating microphone button", - description = "Adds an option to hide the floating microphone button when searching.", - dependencies = [HideFloatingMicrophoneButtonResourcePatch::class], - compatiblePackages = [ - CompatiblePackage( - "com.google.android.youtube", - [ - "18.38.44", - "18.49.37", - "19.16.39", - "19.25.37", - "19.34.42", - ] - ) - ] -) +@Deprecated("This patch has been merged to HideLayoutComponentsPatch.") @Suppress("unused") object HideFloatingMicrophoneButtonPatch : BytecodePatch( - setOf(ShowFloatingMicrophoneButtonFingerprint) + dependencies = setOf(HideLayoutComponentsPatch::class), ) { - private const val INTEGRATIONS_CLASS_DESCRIPTOR = - "Lapp/revanced/integrations/youtube/patches/HideFloatingMicrophoneButtonPatch;" - - override fun execute(context: BytecodeContext) { - ShowFloatingMicrophoneButtonFingerprint.result?.let { result -> - with(result.mutableMethod) { - val insertIndex = result.scanResult.patternScanResult!!.startIndex + 1 - val showButtonRegister = - getInstruction(insertIndex - 1).registerA - - addInstructions( - insertIndex, - """ - invoke-static {v$showButtonRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->hideFloatingMicrophoneButton(Z)Z - move-result v$showButtonRegister - """ - ) - } - } ?: throw ShowFloatingMicrophoneButtonFingerprint.exception - } -} + override fun execute(context: BytecodeContext) { } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt deleted file mode 100644 index 30dd8e84d1..0000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt +++ /dev/null @@ -1,30 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.floatingmicrophone - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.all.misc.resources.AddResourcesPatch -import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch -import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.youtube.misc.settings.SettingsPatch - -@Patch( - dependencies = [ - SettingsPatch::class, - ResourceMappingPatch::class, - AddResourcesPatch::class, - ], -) -internal object HideFloatingMicrophoneButtonResourcePatch : ResourcePatch() { - internal var fabButtonId: Long = -1 - - override fun execute(context: ResourceContext) { - AddResourcesPatch(this::class) - - SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences( - SwitchPreference("revanced_hide_floating_microphone_button"), - ) - - fabButtonId = ResourceMappingPatch["id", "fab"] - } -} 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 202bb19c4e..b9e8c8598f 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 @@ -7,6 +7,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstructions import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction +import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch @@ -14,17 +15,23 @@ import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.all.misc.resources.AddResourcesPatch import app.revanced.patches.shared.misc.settings.preference.* import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen.Sorting +import app.revanced.patches.youtube.layout.hide.general.fingerprints.AlbumCardsFingerprint +import app.revanced.patches.youtube.layout.hide.general.fingerprints.CrowdfundingBoxFingerprint +import app.revanced.patches.youtube.layout.hide.general.fingerprints.FilterBarHeightFingerprint import app.revanced.patches.youtube.layout.hide.general.fingerprints.HideShowMoreButtonFingerprint import app.revanced.patches.youtube.layout.hide.general.fingerprints.ParseElementFromBufferFingerprint import app.revanced.patches.youtube.layout.hide.general.fingerprints.PlayerOverlayFingerprint +import app.revanced.patches.youtube.layout.hide.general.fingerprints.RelatedChipCloudFingerprint +import app.revanced.patches.youtube.layout.hide.general.fingerprints.SearchResultsChipBarFingerprint +import app.revanced.patches.youtube.layout.hide.general.fingerprints.ShowFloatingMicrophoneButtonFingerprint import app.revanced.patches.youtube.layout.hide.general.fingerprints.ShowWatermarkFingerprint import app.revanced.patches.youtube.layout.hide.general.fingerprints.YoodlesImageViewFingerprint import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch +import app.revanced.util.alsoResolve import app.revanced.util.findOpcodeIndicesReversed import app.revanced.util.getReference -import app.revanced.util.alsoResolve import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction @@ -61,13 +68,21 @@ object HideLayoutComponentsPatch : BytecodePatch( ParseElementFromBufferFingerprint, PlayerOverlayFingerprint, HideShowMoreButtonFingerprint, + AlbumCardsFingerprint, + CrowdfundingBoxFingerprint, YoodlesImageViewFingerprint, + RelatedChipCloudFingerprint, + SearchResultsChipBarFingerprint, + ShowFloatingMicrophoneButtonFingerprint, + FilterBarHeightFingerprint ), ) { private const val LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/LayoutComponentsFilter;" private const val DESCRIPTION_COMPONENTS_FILTER_CLASS_NAME = "Lapp/revanced/integrations/youtube/patches/components/DescriptionComponentsFilter;" + private const val COMMENTS_FILTER_CLASS_NAME = + "Lapp/revanced/integrations/youtube/patches/components/CommentsFilter;" private const val CUSTOM_FILTER_CLASS_NAME = "Lapp/revanced/integrations/youtube/patches/components/CustomFilter;" private const val KEYWORD_FILTER_CLASS_NAME = @@ -77,11 +92,6 @@ object HideLayoutComponentsPatch : BytecodePatch( AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_channel_bar"), - SwitchPreference("revanced_hide_channel_guidelines"), - SwitchPreference("revanced_hide_channel_member_shelf"), - SwitchPreference("revanced_hide_channel_watermark"), - SwitchPreference("revanced_hide_community_guidelines"), PreferenceScreen( key = "revanced_hide_description_components_screen", preferences = setOf( @@ -93,6 +103,23 @@ object HideLayoutComponentsPatch : BytecodePatch( SwitchPreference("revanced_hide_transcript_section"), ), ), + PreferenceScreen( + "revanced_comments_screen", + preferences = setOf( + SwitchPreference("revanced_hide_comments_by_members_header"), + SwitchPreference("revanced_hide_comments_section"), + SwitchPreference("revanced_hide_comments_create_a_short_button"), + SwitchPreference("revanced_hide_comments_preview_comment"), + SwitchPreference("revanced_hide_comments_thanks_button"), + SwitchPreference("revanced_hide_comments_timestamp_and_emoji_buttons") + ), + sorting = PreferenceScreen.Sorting.UNSORTED + ), + SwitchPreference("revanced_hide_channel_bar"), + SwitchPreference("revanced_hide_channel_guidelines"), + SwitchPreference("revanced_hide_channel_member_shelf"), + SwitchPreference("revanced_hide_channel_watermark"), + SwitchPreference("revanced_hide_community_guidelines"), SwitchPreference("revanced_hide_emergency_box"), SwitchPreference("revanced_hide_info_panels"), SwitchPreference("revanced_hide_join_membership_button"), @@ -105,12 +132,36 @@ object HideLayoutComponentsPatch : BytecodePatch( ) SettingsPatch.PreferenceScreen.FEED.addPreferences( + PreferenceScreen( + key = "revanced_hide_keyword_content_screen", + sorting = Sorting.UNSORTED, + preferences = setOf( + SwitchPreference("revanced_hide_keyword_content_home"), + SwitchPreference("revanced_hide_keyword_content_subscriptions"), + 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") + ) + ), + PreferenceScreen( + key = "revanced_hide_filter_bar_screen", + preferences = setOf( + SwitchPreference("revanced_hide_filter_bar_feed_in_feed"), + SwitchPreference("revanced_hide_filter_bar_feed_in_search"), + SwitchPreference("revanced_hide_filter_bar_feed_in_related_videos"), + ), + ), + SwitchPreference("revanced_hide_album_cards"), SwitchPreference("revanced_hide_artist_cards"), SwitchPreference("revanced_hide_community_posts"), SwitchPreference("revanced_hide_compact_banner"), + SwitchPreference("revanced_hide_crowdfunding_box"), SwitchPreference("revanced_hide_chips_shelf"), SwitchPreference("revanced_hide_expandable_chip"), SwitchPreference("revanced_hide_feed_survey"), + SwitchPreference("revanced_hide_floating_microphone_button"), SwitchPreference("revanced_hide_for_you_shelf"), SwitchPreference("revanced_hide_horizontal_shelves"), SwitchPreference("revanced_hide_image_shelf"), @@ -123,19 +174,6 @@ object HideLayoutComponentsPatch : BytecodePatch( SwitchPreference("revanced_hide_search_result_shelf_header"), SwitchPreference("revanced_hide_show_more_button"), SwitchPreference("revanced_hide_doodles"), - PreferenceScreen( - key = "revanced_hide_keyword_content_screen", - sorting = Sorting.UNSORTED, - preferences = setOf( - SwitchPreference("revanced_hide_keyword_content_home"), - SwitchPreference("revanced_hide_keyword_content_subscriptions"), - 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( @@ -153,6 +191,7 @@ object HideLayoutComponentsPatch : BytecodePatch( LithoFilterPatch.addFilter(LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR) LithoFilterPatch.addFilter(DESCRIPTION_COMPONENTS_FILTER_CLASS_NAME) + LithoFilterPatch.addFilter(COMMENTS_FILTER_CLASS_NAME) LithoFilterPatch.addFilter(KEYWORD_FILTER_CLASS_NAME) LithoFilterPatch.addFilter(CUSTOM_FILTER_CLASS_NAME) @@ -213,8 +252,60 @@ object HideLayoutComponentsPatch : BytecodePatch( val insertIndex = moveRegisterIndex + 1 addInstruction( insertIndex, - "invoke-static { v$viewRegister }, " + - "$LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR->hideShowMoreButton(Landroid/view/View;)V", + "invoke-static { v$viewRegister }, $LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR" + + "->hideShowMoreButton(Landroid/view/View;)V", + ) + } + } + + // endregion + + // region crowd funding box + CrowdfundingBoxFingerprint.resultOrThrow().let { + it.mutableMethod.apply { + val insertIndex = it.scanResult.patternScanResult!!.endIndex + val objectRegister = getInstruction(insertIndex).registerA + + addInstruction( + insertIndex, + "invoke-static {v$objectRegister}, $LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR" + + "->hideCrowdfundingBox(Landroid/view/View;)V") + } + } + + // endregion + + // region hide album cards + + AlbumCardsFingerprint.resultOrThrow().let { + it.mutableMethod.apply { + val checkCastAnchorIndex = it.scanResult.patternScanResult!!.endIndex + val insertIndex = checkCastAnchorIndex + 1 + val register = getInstruction(checkCastAnchorIndex).registerA + + addInstruction( + insertIndex, + "invoke-static { v$register }, $LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR" + + "->hideAlbumCard(Landroid/view/View;)V" + ) + } + } + + // endregion + + // region hide floating microphone + + ShowFloatingMicrophoneButtonFingerprint.resultOrThrow().let { result -> + with(result.mutableMethod) { + val startIndex = result.scanResult.patternScanResult!!.startIndex + val register = getInstruction(startIndex).registerA + + addInstructions( + startIndex + 1, + """ + invoke-static { v$register }, $LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR->hideFloatingMicrophoneButton(Z)Z + move-result v$register + """ ) } } @@ -243,5 +334,50 @@ object HideLayoutComponentsPatch : BytecodePatch( } // endregion + + // region hide filter bar + + FilterBarHeightFingerprint.patch { register -> + """ + invoke-static { v$register }, $LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR->hideInFeed(I)I + move-result v$register + """ + } + + SearchResultsChipBarFingerprint.patch(-1, -2) { register -> + """ + invoke-static { v$register }, $LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR->hideInSearch(I)I + move-result v$register + """ + } + + RelatedChipCloudFingerprint.patch(1) { register -> + "invoke-static { v$register }, " + + "$LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR->hideInRelatedVideos(Landroid/view/View;)V" + } + } + + /** + * Patch a [MethodFingerprint] with a given [instructions]. + * + * @param RegisterInstruction The type of instruction to get the register from. + * @param insertIndexOffset The offset to add to the end index of the [MethodFingerprint]. + * @param hookRegisterOffset The offset to add to the register of the hook. + * @param instructions The instructions to add with the register as a parameter. + */ + private fun MethodFingerprint.patch( + insertIndexOffset: Int = 0, + hookRegisterOffset: Int = 0, + instructions: (Int) -> String + ) = resultOrThrow().let { + it.mutableMethod.apply { + val endIndex = it.scanResult.patternScanResult!!.endIndex + + val insertIndex = endIndex + insertIndexOffset + val register = + getInstruction(endIndex + hookRegisterOffset).registerA + + addInstructions(insertIndex, instructions(register)) + } } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsResourcePatch.kt index 24dcbb3f19..ce32d2b8a0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsResourcePatch.kt @@ -15,19 +15,56 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch ], ) internal object HideLayoutComponentsResourcePatch : ResourcePatch() { - internal var expandButtonDownId: Long = -1 - + var expandButtonDownId: Long = -1 + var albumCardId: Long = -1 + var crowdfundingBoxId: Long = -1 var youTubeLogo = -1L + var filterBarHeightId = -1L + var relatedChipCloudMarginId = -1L + var barContainerHeightId = -1L + + var fabButtonId: Long = -1 + override fun execute(context: ResourceContext) { expandButtonDownId = ResourceMappingPatch[ "layout", "expand_button_down", ] + albumCardId = ResourceMappingPatch[ + "layout", + "album_card" + ] + + crowdfundingBoxId = ResourceMappingPatch[ + "layout", + "donation_companion", + ] + youTubeLogo = ResourceMappingPatch[ "id", "youtube_logo" ] + + relatedChipCloudMarginId = ResourceMappingPatch[ + "layout", + "related_chip_cloud_reduced_margins" + ] + + filterBarHeightId = ResourceMappingPatch[ + "dimen", + "filter_bar_height" + ] + + barContainerHeightId = ResourceMappingPatch[ + "dimen", + "bar_container_height" + ] + + fabButtonId = ResourceMappingPatch[ + "id", + "fab" + ] } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/fingerprints/AlbumCardsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/AlbumCardsFingerprint.kt similarity index 69% rename from src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/fingerprints/AlbumCardsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/AlbumCardsFingerprint.kt index 6bbabdf520..7032d1b793 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/fingerprints/AlbumCardsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/AlbumCardsFingerprint.kt @@ -1,7 +1,7 @@ -package app.revanced.patches.youtube.layout.hide.albumcards.fingerprints +package app.revanced.patches.youtube.layout.hide.general.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.layout.hide.albumcards.AlbumCardsResourcePatch +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsResourcePatch import app.revanced.util.patch.LiteralValueFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -16,5 +16,5 @@ internal object AlbumCardsFingerprint : LiteralValueFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, ), - literalSupplier = { AlbumCardsResourcePatch.albumCardId } + literalSupplier = { HideLayoutComponentsResourcePatch.albumCardId } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/CrowdfundingBoxFingerprint.kt similarity index 65% rename from src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/CrowdfundingBoxFingerprint.kt index 465b10bfe5..ec40629ee0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/fingerprints/CrowdfundingBoxFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/CrowdfundingBoxFingerprint.kt @@ -1,7 +1,7 @@ -package app.revanced.patches.youtube.layout.hide.crowdfundingbox.fingerprints +package app.revanced.patches.youtube.layout.hide.general.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.layout.hide.crowdfundingbox.CrowdfundingBoxResourcePatch +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsResourcePatch import app.revanced.util.patch.LiteralValueFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -13,5 +13,5 @@ internal object CrowdfundingBoxFingerprint : LiteralValueFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.IPUT_OBJECT, ), - literalSupplier = { CrowdfundingBoxResourcePatch.crowdfundingBoxId } + literalSupplier = { HideLayoutComponentsResourcePatch.crowdfundingBoxId } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/FilterBarHeightFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/FilterBarHeightFingerprint.kt similarity index 67% rename from src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/FilterBarHeightFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/FilterBarHeightFingerprint.kt index b15abf5bb9..c074abd426 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/FilterBarHeightFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/FilterBarHeightFingerprint.kt @@ -1,7 +1,7 @@ -package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints +package app.revanced.patches.youtube.layout.hide.general.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.layout.hide.filterbar.HideFilterBarResourcePatch +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsResourcePatch import app.revanced.util.patch.LiteralValueFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -15,5 +15,5 @@ internal object FilterBarHeightFingerprint : LiteralValueFingerprint( Opcode.MOVE_RESULT, Opcode.IPUT ), - literalSupplier = { HideFilterBarResourcePatch.filterBarHeightId } + literalSupplier = { HideLayoutComponentsResourcePatch.filterBarHeightId } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/RelatedChipCloudFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/RelatedChipCloudFingerprint.kt similarity index 65% rename from src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/RelatedChipCloudFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/RelatedChipCloudFingerprint.kt index d9efa6c49d..2f51b6611f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/RelatedChipCloudFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/RelatedChipCloudFingerprint.kt @@ -1,7 +1,7 @@ -package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints +package app.revanced.patches.youtube.layout.hide.general.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.layout.hide.filterbar.HideFilterBarResourcePatch +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsResourcePatch import app.revanced.util.patch.LiteralValueFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -14,5 +14,5 @@ internal object RelatedChipCloudFingerprint : LiteralValueFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - literalSupplier = { HideFilterBarResourcePatch.relatedChipCloudMarginId } + literalSupplier = { HideLayoutComponentsResourcePatch.relatedChipCloudMarginId } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/SearchResultsChipBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/SearchResultsChipBarFingerprint.kt similarity index 68% rename from src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/SearchResultsChipBarFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/SearchResultsChipBarFingerprint.kt index ed1179ba72..27fc800c30 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/fingerprints/SearchResultsChipBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/SearchResultsChipBarFingerprint.kt @@ -1,7 +1,7 @@ -package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints +package app.revanced.patches.youtube.layout.hide.general.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.layout.hide.filterbar.HideFilterBarResourcePatch +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsResourcePatch import app.revanced.util.patch.LiteralValueFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -16,5 +16,5 @@ internal object SearchResultsChipBarFingerprint : LiteralValueFingerprint( Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT ), - literalSupplier = { HideFilterBarResourcePatch.barContainerHeightId } + literalSupplier = { HideLayoutComponentsResourcePatch.barContainerHeightId } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt similarity index 64% rename from src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt index 4abde10606..b9a1a7b3b7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/ShowFloatingMicrophoneButtonFingerprint.kt @@ -1,7 +1,7 @@ -package app.revanced.patches.youtube.layout.hide.floatingmicrophone.fingerprints +package app.revanced.patches.youtube.layout.hide.general.fingerprints import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.layout.hide.floatingmicrophone.HideFloatingMicrophoneButtonResourcePatch +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsResourcePatch import app.revanced.util.patch.LiteralValueFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -15,5 +15,5 @@ internal object ShowFloatingMicrophoneButtonFingerprint : LiteralValueFingerprin Opcode.IF_EQZ, Opcode.RETURN_VOID ), - literalSupplier = { HideFloatingMicrophoneButtonResourcePatch.fabButtonId } + literalSupplier = { HideLayoutComponentsResourcePatch.fabButtonId } ) \ No newline at end of file diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index d08ae90ea1..05c06137ac 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -107,6 +107,15 @@ This is because Crowdin requires temporarily flattening this file and removing t Disable like / subscribe button glow Like and subscribe button will not glow when mentioned Like and subscribe button will glow when mentioned + Hide album cards + Album cards are hidden + Album cards are shown + Hide crowdfunding box + Crowdfunding box is hidden + Crowdfunding box is shown + Hide floating microphone button + Microphone button hidden + Microphone button shown Hide gray separator Gray separators are hidden Gray separators are shown @@ -232,6 +241,39 @@ This is because Crowdin requires temporarily flattening this file and removing t Video description Hide or show video description components + Filter bar + Hide or show the filter bar in the feed, search, and related videos + Hide in feed + Hidden in feed + Shown in feed + Hide in search + Hidden in search + Shown in search + Hide in related videos + Hidden in related videos + Shown in related videos + + Comments + Hide or show comments section components + Hide \'Comments by members\' header + \'Comments by members\' header is hidden + \'Comments by members\' header is shown + Hide comments section + Comments section is hidden + Comments section is shown + Hide \'Create a Short\' button + \'Create a Short\' button is hidden + \'Create a Short\' button is shown + Hide preview comment + Preview comment is hidden + Preview comment is shown + Hide thanks button + Thanks button is hidden + Thanks button is shown + Hide timestamp and emoji buttons + Timestamp and emoji buttons are hidden + Timestamp and emoji buttons are shown + Hide YouTube Doodles Search bar Doodles are hidden @@ -523,61 +565,11 @@ This is because Crowdin requires temporarily flattening this file and removing t Buttons are hidden Buttons are shown - - Hide album cards - Album cards are hidden - Album cards are shown - - - Comments - Hide or show comments section components - Hide \'Comments by members\' header - \'Comments by members\' header is hidden - \'Comments by members\' header is shown - Hide comments section - Comments section is hidden - Comments section is shown - Hide \'Create a Short\' button - \'Create a Short\' button is hidden - \'Create a Short\' button is shown - Hide preview comment - Preview comment is hidden - Preview comment is shown - Hide thanks button - Thanks button is hidden - Thanks button is shown - Hide timestamp and emoji buttons - Timestamp and emoji buttons are hidden - Timestamp and emoji buttons are shown - - - Hide crowdfunding box - Crowdfunding box is hidden - Crowdfunding box is shown - Hide end screen cards End screen cards are hidden End screen cards are shown - - Filter bar - Hide or show the filter bar in the feed, search, and related videos - Hide in feed - Hidden in feed - Shown in feed - Hide in search - Hidden in search - Shown in search - Hide in related videos - Hidden in related videos - Shown in related videos - - - Hide floating microphone button - Microphone button hidden - Microphone button shown - Disable ambient mode in fullscreen Ambient mode disabled