mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-30 10:42:55 +01:00
fix(Twitter): Fix patches by matching fingerprint using correct class
This commit is contained in:
parent
a0d9c25ffa
commit
6ae0d124e1
@ -47,18 +47,22 @@ val jsonHookPatch = bytecodePatch(
|
||||
dependsOn(sharedExtensionPatch)
|
||||
|
||||
execute {
|
||||
val jsonFactoryClassDef = jsonHookPatchFingerprint.apply {
|
||||
jsonHookPatchFingerprint.apply {
|
||||
// Make sure the extension is present.
|
||||
val jsonHookPatch = classBy { classDef -> classDef.type == JSON_HOOK_PATCH_CLASS_DESCRIPTOR }
|
||||
?: throw PatchException("Could not find the extension.")
|
||||
|
||||
matchOrNull(jsonHookPatch.immutableClass)
|
||||
?: throw PatchException("Unexpected extension.")
|
||||
}.originalClassDef // Conveniently find the type to hook a method in, via a named field.
|
||||
}
|
||||
|
||||
val jsonFactoryClassDef =
|
||||
loganSquareFingerprint.originalClassDef // Conveniently find the type to hook a method in, via a named field.
|
||||
.fields
|
||||
.firstOrNull { it.name == "JSON_FACTORY" }
|
||||
?.type
|
||||
.let { type -> classes.find { it.type == type } } ?: throw PatchException("Could not find required class.")
|
||||
.let { type -> classes.find { it.type == type } }
|
||||
?: throw PatchException("Could not find required class.")
|
||||
|
||||
// Hook the methods first parameter.
|
||||
jsonInputStreamFingerprint.match(jsonFactoryClassDef).method.addInstructions(
|
||||
|
Loading…
Reference in New Issue
Block a user