diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch.kt index 9cf84495..eb7f7e87 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch.kt @@ -11,23 +11,25 @@ import com.android.tools.smali.dexlib2.iface.ClassDef import com.android.tools.smali.dexlib2.iface.Method abstract class BaseIntegrationsPatch( - private val hooks: Set + private val hooks: Set, ) : BytecodePatch(hooks) { @Deprecated( "Use the constructor without the integrationsDescriptor parameter", - ReplaceWith("AbstractIntegrationsPatch(hooks)") + ReplaceWith("BaseIntegrationsPatch(hooks)"), ) @Suppress("UNUSED_PARAMETER") constructor( integrationsDescriptor: String, - hooks: Set + hooks: Set, ) : this(hooks) override fun execute(context: BytecodeContext) { - if (context.findClass(INTEGRATIONS_CLASS_DESCRIPTOR) == null) throw PatchException( - "Integrations have not been merged yet. This patch can not succeed without merging the integrations." - ) + if (context.findClass(INTEGRATIONS_CLASS_DESCRIPTOR) == null) { + throw PatchException( + "Integrations have not been merged yet. This patch can not succeed without merging the integrations.", + ) + } hooks.forEach { hook -> hook.invoke(INTEGRATIONS_CLASS_DESCRIPTOR) @@ -47,14 +49,14 @@ abstract class BaseIntegrationsPatch( opcodes: Iterable? = null, strings: Iterable? = null, customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null, - private val contextRegisterResolver: (Method) -> Int = object : IRegisterResolver {} + private val contextRegisterResolver: (Method) -> Int = object : IRegisterResolver {}, ) : MethodFingerprint( returnType, accessFlags, parameters, opcodes, strings, - customFingerprint + customFingerprint, ) { fun invoke(integrationsDescriptor: String) { result?.mutableMethod?.let { method -> @@ -63,7 +65,7 @@ abstract class BaseIntegrationsPatch( method.addInstruction( 0, "sput-object v$contextRegister, " + - "$integrationsDescriptor->context:Landroid/content/Context;" + "$integrationsDescriptor->context:Landroid/content/Context;", ) } ?: throw PatchException("Could not find hook target fingerprint.") } @@ -76,4 +78,4 @@ abstract class BaseIntegrationsPatch( private companion object { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/shared/Utils;" } -} \ No newline at end of file +}