refactor(piccomafr): DisableTrackingPatch

This commit is contained in:
Pun Butrach
2026-01-12 00:04:41 +07:00
parent 1cecadf54c
commit c17bfcb452
2 changed files with 16 additions and 20 deletions

View File

@@ -3,16 +3,15 @@ package app.revanced.patches.piccomafr.tracking
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instructions
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.creatingBytecodePatch
import app.revanced.util.getReference
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.StringReference
@Suppress("unused")
val disableTrackingPatch = bytecodePatch(
name = "Disable tracking",
description = "Disables tracking by replacing tracking URLs with example.com.",
@Suppress("unused", "ObjectPropertyName")
val `Disable tracking` by creatingBytecodePatch(
description = "Disables tracking by replacing tracking URLs with example.com."
) {
compatibleWith(
"com.piccomaeurope.fr"(
@@ -34,7 +33,7 @@ val disableTrackingPatch = bytecodePatch(
)
apply {
facebookSDKFingerprint.method.apply {
facebookSDKMethod.apply {
instructions.filter { instruction ->
instruction.opcode == Opcode.CONST_STRING
}.forEach { instruction ->
@@ -47,7 +46,7 @@ val disableTrackingPatch = bytecodePatch(
}
}
firebaseInstallFingerprint.method.apply {
firebaseInstallMethod.apply {
instructions.filter {
it.opcode == Opcode.CONST_STRING
}.filter {
@@ -62,6 +61,6 @@ val disableTrackingPatch = bytecodePatch(
}
}
appMeasurementFingerprint.method.addInstruction(0, "return-void")
appMeasurementMethod.addInstruction(0, "return-void")
}
}

View File

@@ -1,23 +1,20 @@
package app.revanced.patches.piccomafr.tracking
import app.revanced.patcher.fingerprint
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.accessFlags
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.returnType
import com.android.tools.smali.dexlib2.AccessFlags
internal val appMeasurementFingerprint = fingerprint {
internal val BytecodePatchContext.appMeasurementMethod by gettingFirstMutableMethodDeclaratively("config/app/", "Fetching remote configuration") {
accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL)
returns("V")
strings("config/app/", "Fetching remote configuration")
returnType("V")
}
internal val facebookSDKFingerprint = fingerprint {
accessFlags(AccessFlags.STATIC, AccessFlags.CONSTRUCTOR)
strings("instagram.com", "facebook.com")
internal val BytecodePatchContext.facebookSDKMethod by gettingFirstMutableMethodDeclaratively("instagram.com", "facebook.com") {
accessFlags(AccessFlags.PRIVATE, AccessFlags.CONSTRUCTOR)
}
internal val firebaseInstallFingerprint = fingerprint {
internal val BytecodePatchContext.firebaseInstallMethod by gettingFirstMutableMethodDeclaratively("https://%s/%s/%s", "firebaseinstallations.googleapis.com") {
accessFlags(AccessFlags.PRIVATE)
strings(
"https://%s/%s/%s",
"firebaseinstallations.googleapis.com",
)
}