From 3e0df76545b2599462e05d7239c3d8ecf8872ca0 Mon Sep 17 00:00:00 2001 From: OxrxL <108184954+OxrxL@users.noreply.github.com> Date: Mon, 7 Nov 2022 13:55:31 +0100 Subject: [PATCH] refactor(youtube/general-ads-patch): remove unnecessary patches (#994) --- .../bytecode/patch/GeneralBytecodeAdsPatch.kt | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt index 405232b0..78e26f07 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt @@ -29,11 +29,9 @@ import app.revanced.patches.youtube.misc.settings.framework.components.impl.Stri import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.instruction.BuilderInstruction10x +import org.jf.dexlib2.dexbacked.instruction.DexBackedInstruction21c import org.jf.dexlib2.iface.instruction.OneRegisterInstruction -import org.jf.dexlib2.iface.instruction.formats.Instruction21c -import org.jf.dexlib2.iface.instruction.formats.Instruction22c -import org.jf.dexlib2.iface.instruction.formats.Instruction31i -import org.jf.dexlib2.iface.instruction.formats.Instruction35c +import org.jf.dexlib2.iface.instruction.formats.* import org.jf.dexlib2.iface.reference.FieldReference import org.jf.dexlib2.iface.reference.MethodReference import org.jf.dexlib2.iface.reference.StringReference @@ -56,8 +54,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() { "endscreen_element_layout_video", "endscreen_element_layout_circle", "endscreen_element_layout_icon", - "promoted_video_item_land", - "promoted_video_item_full_bleed", ).map { name -> ResourceMappingResourcePatch.resourceMappings.single { it.name == name }.id } @@ -266,26 +262,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() { """ ) } - - resourceIds[6] -> { - // and is followed by an instruction with the mnemonic INVOKE_DIRECT - val insertIndex = index + 3 - val invokeInstruction = instructions.elementAt(insertIndex) - if (invokeInstruction.opcode != Opcode.INVOKE_DIRECT) return@forEachIndexed - - // create proxied method, make sure to not re-resolve() the current class - if (mutableClass == null) mutableClass = context.proxy(classDef).mutableClass - if (mutableMethod == null) mutableMethod = - mutableClass!!.findMutableMethodOf(method) - - // insert hide call to hide the view corresponding to the resource - val viewRegister = (invokeInstruction as Instruction35c).registerE - mutableMethod!!.implementation!!.injectHideCall(insertIndex, viewRegister) - } - - resourceIds[7] -> { - // TODO, go to class, hide the inflated view - } } }