From 1a6ca7a88d9e51cd23b8f5bb5c5e7bc7f03932a7 Mon Sep 17 00:00:00 2001 From: inotia00 Date: Sun, 23 Apr 2023 02:25:28 +0900 Subject: [PATCH] remove `hide-fullscreen-buttoncontainer` patch --- ...eFullscreenButtonContainerBytecodePatch.kt | 60 ------------------- .../HideFullscreenButtonContainerPatch.kt | 45 -------------- .../patch/HideFullscreenPanelsPatch.kt | 4 +- .../youtube/settings/host/values/strings.xml | 3 - .../youtube/settings/xml/revanced_prefs.xml | 4 -- 5 files changed, 2 insertions(+), 114 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/bytecode/patch/HideFullscreenButtonContainerBytecodePatch.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/resource/patch/HideFullscreenButtonContainerPatch.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/bytecode/patch/HideFullscreenButtonContainerBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/bytecode/patch/HideFullscreenButtonContainerBytecodePatch.kt deleted file mode 100644 index 556cf4942..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/bytecode/patch/HideFullscreenButtonContainerBytecodePatch.kt +++ /dev/null @@ -1,60 +0,0 @@ -package app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch - -import app.revanced.extensions.findMutableMethodOf -import app.revanced.extensions.injectHideCall -import app.revanced.extensions.toResult -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.patches.shared.annotation.YouTubeCompatibility -import app.revanced.patches.shared.patch.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 HideFullscreenButtonContainerBytecodePatch : 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/FullscreenPatch", "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/HideFullscreenButtonContainerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/resource/patch/HideFullscreenButtonContainerPatch.kt deleted file mode 100644 index 71198e8a6..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenbuttoncontainer/resource/patch/HideFullscreenButtonContainerPatch.kt +++ /dev/null @@ -1,45 +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.PatchResult -import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patches.shared.annotation.YouTubeCompatibility -import app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch.HideFullscreenButtonContainerBytecodePatch -import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch - -@Patch -@Name("hide-fullscreen-buttoncontainer") -@Description("Hides the button containers in fullscreen.") -@DependsOn( - [ - HideFullscreenButtonContainerBytecodePatch::class, - SettingsPatch::class - ] -) -@YouTubeCompatibility -@Version("0.0.1") -class HideFullscreenButtonContainerPatch : ResourcePatch { - - override fun execute(context: ResourceContext): PatchResult { - - /* - * Add ReVanced Settings - */ - SettingsPatch.addPreference( - arrayOf( - "PREFERENCE: FULLSCREEN_SETTINGS", - "SETTINGS: HIDE_FULLSCREEN_BUTTON_CONTAINER" - ) - ) - - SettingsPatch.updatePatchStatus("hide-fullscreen-buttoncontainer") - - return PatchResultSuccess() - } -} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/patch/HideFullscreenPanelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/patch/HideFullscreenPanelsPatch.kt index ca69c1db4..c069f6b16 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/patch/HideFullscreenPanelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreen/fullscreenpanels/patch/HideFullscreenPanelsPatch.kt @@ -16,8 +16,8 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint -import app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch.HideFullscreenButtonContainerBytecodePatch import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint +import app.revanced.patches.youtube.layout.fullscreen.quickactions.patch.QuickActionsPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.util.integrations.Constants.FULLSCREEN import org.jf.dexlib2.Opcode @@ -31,7 +31,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c @Description("Hides video description and comments panel in fullscreen view.") @DependsOn( [ - HideFullscreenButtonContainerBytecodePatch::class, + QuickActionsPatch::class, SettingsPatch::class ] ) diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index 17d9ee733..693581203 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -276,9 +276,6 @@ Please do not report any issues you encounter while using this feature."Floating microphone button is shown Floating microphone button is hidden Hide floating microphone button - Fullscreen button container is shown - Fullscreen button container is hidden - Hide fullscreen button container Fullscreen panels are shown Fullscreen panels are hidden Hide fullscreen panels diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 80a49b59a..fba07b71a 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -207,9 +207,6 @@ SETTINGS: HIDE_FULLSCREEN_PANELS --> - - @@ -498,7 +495,6 @@ -