refactor(youtube/general-ads-patch): removed redundant code (#1003)

This commit is contained in:
OxrxL 2022-11-08 18:10:04 +01:00 committed by GitHub
parent e5abf92640
commit 9770ba2a0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
private val resourceIds = arrayOf(
"ad_attribution",
"reel_multiple_items_shelf",
"info_cards_drawer_header",
).map { name ->
ResourceMappingResourcePatch.resourceMappings.single { it.name == name }.id
}
@ -224,21 +223,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
val viewRegister = (iPutInstruction as Instruction22c).registerA
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)
}
}
}