From c2cef20998876eba906e013606ac9708cd685a27 Mon Sep 17 00:00:00 2001 From: inotia00 Date: Sun, 5 Feb 2023 12:43:03 +0900 Subject: [PATCH] remove `hide-fullscreen-buttoncontainer` patch --- .../FullscreenButtonContainerBytecodePatch.kt | 60 ------------------- .../patch/FullscreenButtonContainerPatch.kt | 49 --------------- .../youtube/settings/host/values/strings.xml | 3 - .../youtube/settings/xml/revanced_prefs.xml | 3 - 4 files changed, 115 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/bytecode/patch/FullscreenButtonContainerBytecodePatch.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/resource/patch/FullscreenButtonContainerPatch.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/bytecode/patch/FullscreenButtonContainerBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/bytecode/patch/FullscreenButtonContainerBytecodePatch.kt deleted file mode 100644 index 1e83f3441..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/bytecode/patch/FullscreenButtonContainerBytecodePatch.kt +++ /dev/null @@ -1,60 +0,0 @@ -package app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch - -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.annotations.DependsOn -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.extensions.findMutableMethodOf -import app.revanced.shared.extensions.injectHideCall -import app.revanced.shared.extensions.toResult -import app.revanced.shared.patches.mapping.ResourceMappingPatch -import org.jf.dexlib2.Opcode -import org.jf.dexlib2.iface.instruction.formats.Instruction21c -import org.jf.dexlib2.iface.instruction.formats.Instruction31i - -@Name("hide-fullscreen-buttoncontainer-bytecode-patch") -@DependsOn([ResourceMappingPatch::class]) -@YouTubeCompatibility -@Version("0.0.1") -class FullscreenButtonContainerBytecodePatch : BytecodePatch() { - private val resourceIds = arrayOf( - "quick_actions_element_container" - ).map { name -> - ResourceMappingPatch.resourceMappings.single { it.name == name }.id - } - private var patchSuccessArray = Array(resourceIds.size) {false} - - override fun execute(context: BytecodeContext): PatchResult { - context.classes.forEach { classDef -> - classDef.methods.forEach { method -> - with(method.implementation) { - this?.instructions?.forEachIndexed { index, instruction -> - when (instruction.opcode) { - Opcode.CONST -> { - when ((instruction as Instruction31i).wideLiteral) { - resourceIds[0] -> { // fullscreen panel - val insertIndex = index + 3 - val invokeInstruction = instructions.elementAt(insertIndex) - if (invokeInstruction.opcode != Opcode.CHECK_CAST) return@forEachIndexed - - val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method) - - val viewRegister = (invokeInstruction as Instruction21c).registerA - mutableMethod.implementation!!.injectHideCall(insertIndex, viewRegister, "layout/FullscreenLayoutPatch", "hideFullscreenButtonContainer") - - patchSuccessArray[0] = true; - } - } - } - else -> return@forEachIndexed - } - } - } - } - } - return toResult(patchSuccessArray.indexOf(false)) - } -} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/resource/patch/FullscreenButtonContainerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/resource/patch/FullscreenButtonContainerPatch.kt deleted file mode 100644 index b83226830..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/resource/patch/FullscreenButtonContainerPatch.kt +++ /dev/null @@ -1,49 +0,0 @@ -package app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.resource.patch - -import app.revanced.patcher.annotation.Description -import app.revanced.patcher.annotation.Name -import app.revanced.patcher.annotation.Version -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch.FullscreenButtonContainerBytecodePatch -import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.shared.annotation.YouTubeCompatibility -import app.revanced.shared.util.resources.ResourceHelper - -@Patch -@Name("hide-fullscreen-buttoncontainer") -@Description("Hides the button containers in fullscreen.") -@DependsOn( - [ - FullscreenButtonContainerBytecodePatch::class, - SettingsPatch::class - ] -) -@YouTubeCompatibility -@Version("0.0.1") -class FullscreenButtonContainerPatch : ResourcePatch { - override fun execute(context: ResourceContext): PatchResult { - - /* - add settings - */ - ResourceHelper.addSettings2( - context, - "PREFERENCE_CATEGORY: REVANCED_SETTINGS", - "PREFERENCE: LAYOUT_SETTINGS", - "PREFERENCE_HEADER: FULLSCREEN", - "SETTINGS: HIDE_FULLSCREEN_BUTTON_CONTAINER" - ) - - ResourceHelper.patchSuccess( - context, - "hide-fullscreen-buttoncontainer" - ) - - return PatchResultSuccess() - } -} \ No newline at end of file diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index 6ba0ff3d0..0db30ce17 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -331,9 +331,6 @@ Is it ready to submit?" Film strip overlay are shown Film strip overlay are hidden Hide film strip overlay - Fullscreen button container is shown - Fullscreen button container is hidden - Hide fullscreen button container Info cards are shown Info cards are hidden Hide info cards diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 83a75a278..0fa84120f 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -185,8 +185,6 @@ - @@ -388,7 +386,6 @@ -