mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-03 22:53:01 +01:00
refactor(youtube/general-ads-patch): removed redundant code (#1003)
This commit is contained in:
parent
e5abf92640
commit
9770ba2a0e
@ -50,7 +50,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
private val resourceIds = arrayOf(
|
private val resourceIds = arrayOf(
|
||||||
"ad_attribution",
|
"ad_attribution",
|
||||||
"reel_multiple_items_shelf",
|
"reel_multiple_items_shelf",
|
||||||
"info_cards_drawer_header",
|
|
||||||
).map { name ->
|
).map { name ->
|
||||||
ResourceMappingResourcePatch.resourceMappings.single { it.name == name }.id
|
ResourceMappingResourcePatch.resourceMappings.single { it.name == name }.id
|
||||||
}
|
}
|
||||||
@ -224,21 +223,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
val viewRegister = (iPutInstruction as Instruction22c).registerA
|
val viewRegister = (iPutInstruction as Instruction22c).registerA
|
||||||
mutableMethod!!.implementation!!.injectHideCall(insertIndex, viewRegister)
|
mutableMethod!!.implementation!!.injectHideCall(insertIndex, viewRegister)
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceIds[2] -> { // info cards ads
|
|
||||||
// and is followed by an instruction with the mnemonic INVOKE_VIRTUAL
|
|
||||||
val removeIndex = index - 1
|
|
||||||
val invokeInstruction = instructions.elementAt(removeIndex)
|
|
||||||
if (invokeInstruction.opcode != Opcode.INVOKE_VIRTUAL) 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)
|
|
||||||
|
|
||||||
//ToDo: Add Settings toggle for whatever this is
|
|
||||||
mutableMethod!!.implementation!!.removeInstruction(removeIndex)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user