mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
fix(YouTube/Integrations): skip patches even in versions where fingerprints are still used
This commit is contained in:
@ -6,9 +6,9 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
|
|||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patches.shared.integrations.BaseIntegrationsPatch.IntegrationsFingerprint.IRegisterResolver
|
import app.revanced.patches.shared.integrations.BaseIntegrationsPatch.IntegrationsFingerprint.IRegisterResolver
|
||||||
import app.revanced.patches.shared.integrations.Constants.INTEGRATIONS_UTILS_CLASS_DESCRIPTOR
|
import app.revanced.patches.shared.integrations.Constants.INTEGRATIONS_UTILS_CLASS_DESCRIPTOR
|
||||||
|
import app.revanced.util.exception
|
||||||
import app.revanced.util.findMethodOrThrow
|
import app.revanced.util.findMethodOrThrow
|
||||||
import app.revanced.util.isDeprecated
|
import app.revanced.util.isDeprecated
|
||||||
import app.revanced.util.resultOrThrow
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
import com.android.tools.smali.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
@ -50,18 +50,21 @@ abstract class BaseIntegrationsPatch(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun invoke(integrationsDescriptor: String) {
|
fun invoke(integrationsDescriptor: String) {
|
||||||
if (isDeprecated()) return
|
val method = result?.mutableMethod
|
||||||
|
?: if (!isDeprecated()) {
|
||||||
|
throw exception
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resultOrThrow().mutableMethod.let { method ->
|
val insertIndex = insertIndexResolver(method)
|
||||||
val insertIndex = insertIndexResolver(method)
|
val contextRegister = contextRegisterResolver(method)
|
||||||
val contextRegister = contextRegisterResolver(method)
|
|
||||||
|
|
||||||
method.addInstruction(
|
method.addInstruction(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
"invoke-static/range { $contextRegister .. $contextRegister }, " +
|
"invoke-static/range { $contextRegister .. $contextRegister }, " +
|
||||||
"$integrationsDescriptor->setContext(Landroid/content/Context;)V",
|
"$integrationsDescriptor->setContext(Landroid/content/Context;)V",
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IHookInsertIndexResolver : (Method) -> Int {
|
interface IHookInsertIndexResolver : (Method) -> Int {
|
||||||
|
Reference in New Issue
Block a user