refactor: make patches compatible with breaking changes of the patcher

This commit is contained in:
oSumAtrIX
2022-04-14 10:17:53 +02:00
parent 582ce70ce2
commit 5119905955
9 changed files with 488 additions and 91 deletions

View File

@ -20,8 +20,8 @@ private val compatiblePackages = arrayOf("com.google.android.youtube")
class IntegrationsPatch : Patch(
metadata = PatchMetadata(
"integrations",
"Inject integrations",
"Applies mandatory patches to implement the ReVanced integrations into the application",
"Inject integrations Patch",
"Applies mandatory patches to implement the ReVanced integrations into the application.",
compatiblePackages,
"1.0.0"
),
@ -76,11 +76,7 @@ class IntegrationsPatch : Patch(
)
) {
override fun execute(patcherData: PatcherData): PatchResult {
val signature = signatures.first()
val result = signatures.first().result
result ?: return PatchResultError(
"Could not resolve required signature ${signature.methodSignatureMetadata.name}"
)
val result = signatures.first().result!!
val implementation = result.method.implementation!!
val count = implementation.registerCount - 1