From c65aa00dc5ca59e4170458e673e73194f6b94e14 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sat, 28 Oct 2023 09:47:41 +0900 Subject: [PATCH] feat(YouTube): remove `Header switch` patch --- .../general/headerswitch/HeaderSwitchPatch.kt | 88 ------------------- .../youtube/settings/host/values/strings.xml | 3 - .../youtube/settings/xml/revanced_prefs.xml | 4 - 3 files changed, 95 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/general/headerswitch/HeaderSwitchPatch.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/headerswitch/HeaderSwitchPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/headerswitch/HeaderSwitchPatch.kt deleted file mode 100644 index d544d7caa..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/general/headerswitch/HeaderSwitchPatch.kt +++ /dev/null @@ -1,88 +0,0 @@ -package app.revanced.patches.youtube.general.headerswitch - -import app.revanced.extensions.findMutableMethodOf -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.utils.resourceid.SharedResourceIdPatch -import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.WordMarkHeader -import app.revanced.patches.youtube.utils.settings.SettingsPatch -import app.revanced.util.bytecode.getWideLiteralIndex -import app.revanced.util.bytecode.isWideLiteralExists -import app.revanced.util.integrations.Constants.GENERAL -import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction - -@Patch( - name = "Header switch", - description = "Add switch to change header.", - dependencies = [ - SettingsPatch::class, - SharedResourceIdPatch::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" - ] - ) - ] -) -@Suppress("unused") -object HeaderSwitchPatch : BytecodePatch() { - @Suppress("LABEL_NAME_CLASH") - override fun execute(context: BytecodeContext) { - context.classes.forEach { classDef -> - classDef.methods.forEach { method -> - if (!method.isWideLiteralExists(WordMarkHeader)) - return@forEach - - context.proxy(classDef) - .mutableClass - .findMutableMethodOf(method) - .apply { - val targetIndex = getWideLiteralIndex(WordMarkHeader) - val targetRegister = - getInstruction(targetIndex).registerA - - addInstructions( - targetIndex + 1, """ - invoke-static {v$targetRegister}, $GENERAL->enablePremiumHeader(I)I - move-result v$targetRegister - """ - ) - } - } - } - - /** - * Add settings - */ - SettingsPatch.addPreference( - arrayOf( - "PREFERENCE: GENERAL_SETTINGS", - "SETTINGS: HEADER_SWITCH" - ) - ) - - SettingsPatch.updatePatchStatus("Header switch") - - } -} diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index 28c5b76df..bf7e8c3c1 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -609,9 +609,6 @@ Tap and hold to copy video timestamp" "Tap to open speed dialog Tap and hold to set playback speed to 1.0x" Show speed dialog button - Current Header: Default Header - Current Header: Premium Header - Premium Header Patches Information Information about applied patches Player diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 13f4f93b5..067fce936 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -214,9 +214,6 @@ - -