fix: 'Hide breaking news shelf' setting hides album card header in search results

This commit is contained in:
inotia00 2023-04-03 21:52:36 +09:00
parent 676ef9b980
commit 2ccafc6b4b

View File

@ -22,8 +22,7 @@ import org.jf.dexlib2.iface.instruction.formats.*
class GeneralAdsBytecodePatch : BytecodePatch() { class GeneralAdsBytecodePatch : BytecodePatch() {
private val resourceIds = arrayOf( private val resourceIds = arrayOf(
"id" to "ad_attribution", "id" to "ad_attribution",
"layout" to "horizontal_card_list", "layout" to "horizontal_card_list"
"layout" to "album_card"
).map { (type, name) -> ).map { (type, name) ->
ResourceMappingPatch ResourceMappingPatch
.resourceMappings .resourceMappings
@ -62,18 +61,6 @@ class GeneralAdsBytecodePatch : BytecodePatch() {
mutableMethod.implementation!!.injectHideCall(insertIndex, viewRegister, "ads/GeneralAdsPatch", "hideBreakingNewsShelf") mutableMethod.implementation!!.injectHideCall(insertIndex, viewRegister, "ads/GeneralAdsPatch", "hideBreakingNewsShelf")
patchSuccessArray[1] = true patchSuccessArray[1] = true
} }
resourceIds[2] -> { // album cards
val insertIndex = index + 4
val invokeInstruction = instructions.elementAt(insertIndex)
if (invokeInstruction.opcode != Opcode.CHECK_CAST) return@forEachIndexed
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
val viewRegister = (invokeInstruction as Instruction21c).registerA
mutableMethod.implementation!!.injectHideCall(insertIndex, viewRegister, "ads/GeneralAdsPatch", "hideAlbumCards")
patchSuccessArray[2] = true
}
} }
} }
else -> return@forEachIndexed else -> return@forEachIndexed