refactor: integrations (#44)

This commit is contained in:
Joey Peter
2022-06-24 00:17:49 +02:00
committed by GitHub
parent e1f37bf7c7
commit a8f17948ac
12 changed files with 18 additions and 19 deletions

View File

@ -28,7 +28,7 @@ class IntegrationsPatch : BytecodePatch(
)
) {
override fun execute(data: BytecodeData): PatchResult {
if (data.findClass("Lapp/revanced/integrations/Globals") == null)
if (data.findClass("Lapp/revanced/integrations/utils/Globals") == null)
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
val result = InitSignature.result!!
@ -38,8 +38,8 @@ class IntegrationsPatch : BytecodePatch(
result.method.addInstructions(
result.scanResult.endIndex + 1, """
invoke-static {v$count}, Lpl/jakubweg/StringRef;->setContext(Landroid/content/Context;)V
sput-object v$count, Lapp/revanced/integrations/Globals;->context:Landroid/content/Context;
invoke-static {v$count}, Lapp/revanced/integrations/sponsorblock/StringRef;->setContext(Landroid/content/Context;)V
sput-object v$count, Lapp/revanced/integrations/utils/Globals;->context:Landroid/content/Context;
"""
)
@ -55,7 +55,7 @@ class IntegrationsPatch : BytecodePatch(
null,
ImmutableMethodImplementation(
1, """
invoke-static { }, Lapp/revanced/integrations/Globals;->getAppContext()Landroid/content/Context;
invoke-static { }, Lapp/revanced/integrations/utils/Globals;->getAppContext()Landroid/content/Context;
move-result-object v0
return-object v0
""".trimIndent().toInstructions(), null, null