mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 09:07:46 +01:00
refactor(youtube/general-ads-patch): remove unnecessary patches (#994)
This commit is contained in:
parent
c2686ac1f9
commit
3e0df76545
1 changed files with 2 additions and 26 deletions
|
@ -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 app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction10x
|
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.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
import org.jf.dexlib2.iface.instruction.formats.*
|
||||||
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.reference.FieldReference
|
import org.jf.dexlib2.iface.reference.FieldReference
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
import org.jf.dexlib2.iface.reference.StringReference
|
import org.jf.dexlib2.iface.reference.StringReference
|
||||||
|
@ -56,8 +54,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
||||||
"endscreen_element_layout_video",
|
"endscreen_element_layout_video",
|
||||||
"endscreen_element_layout_circle",
|
"endscreen_element_layout_circle",
|
||||||
"endscreen_element_layout_icon",
|
"endscreen_element_layout_icon",
|
||||||
"promoted_video_item_land",
|
|
||||||
"promoted_video_item_full_bleed",
|
|
||||||
).map { name ->
|
).map { name ->
|
||||||
ResourceMappingResourcePatch.resourceMappings.single { it.name == name }.id
|
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue