mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-28 18:45:48 +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)
|
dependsOn(sharedExtensionPatch)
|
||||||
|
|
||||||
execute {
|
execute {
|
||||||
val jsonFactoryClassDef = jsonHookPatchFingerprint.apply {
|
jsonHookPatchFingerprint.apply {
|
||||||
// Make sure the extension is present.
|
// Make sure the extension is present.
|
||||||
val jsonHookPatch = classBy { classDef -> classDef.type == JSON_HOOK_PATCH_CLASS_DESCRIPTOR }
|
val jsonHookPatch = classBy { classDef -> classDef.type == JSON_HOOK_PATCH_CLASS_DESCRIPTOR }
|
||||||
?: throw PatchException("Could not find the extension.")
|
?: throw PatchException("Could not find the extension.")
|
||||||
|
|
||||||
matchOrNull(jsonHookPatch.immutableClass)
|
matchOrNull(jsonHookPatch.immutableClass)
|
||||||
?: throw PatchException("Unexpected extension.")
|
?: throw PatchException("Unexpected extension.")
|
||||||
}.originalClassDef // Conveniently find the type to hook a method in, via a named field.
|
}
|
||||||
.fields
|
|
||||||
.firstOrNull { it.name == "JSON_FACTORY" }
|
val jsonFactoryClassDef =
|
||||||
?.type
|
loganSquareFingerprint.originalClassDef // Conveniently find the type to hook a method in, via a named field.
|
||||||
.let { type -> classes.find { it.type == type } } ?: throw PatchException("Could not find required class.")
|
.fields
|
||||||
|
.firstOrNull { it.name == "JSON_FACTORY" }
|
||||||
|
?.type
|
||||||
|
.let { type -> classes.find { it.type == type } }
|
||||||
|
?: throw PatchException("Could not find required class.")
|
||||||
|
|
||||||
// Hook the methods first parameter.
|
// Hook the methods first parameter.
|
||||||
jsonInputStreamFingerprint.match(jsonFactoryClassDef).method.addInstructions(
|
jsonInputStreamFingerprint.match(jsonFactoryClassDef).method.addInstructions(
|
||||||
|
Loading…
Reference in New Issue
Block a user