fix patch

Co-authored-by: rospino74 <34315725+rospino74@users.noreply.github.com>
This commit is contained in:
oSumAtrIX 2026-02-19 16:19:33 +01:00
parent f36b49cb4d
commit fd55e1e627
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
2 changed files with 20 additions and 13 deletions

View file

@ -1,7 +1,10 @@
package app.revanced.patches.instagram.misc.disableAnalytics
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Suppress("unused")
val disableAnalyticsPatch = bytecodePatch(
@ -13,7 +16,7 @@ val disableAnalyticsPatch = bytecodePatch(
apply {
// Returns BOGUS as analytics url.
instagramAnalyticsUrlBuilderMethod.addInstructions(
0,
0,
"""
const-string v0, "BOGUS"
return-object v0
@ -21,13 +24,12 @@ val disableAnalyticsPatch = bytecodePatch(
)
// Replaces analytics url as BOGUS.
facebookAnalyticsUrlInitMethod.addInstructions(
0,
"""
const-string v0, "BOGUS"
return-object v0
"""
)
facebookAnalyticsUrlInitMethodMatch.let { match ->
match.method.apply {
val urlIndex = match[1]
val register = getInstruction<OneRegisterInstruction>(urlIndex).registerA
replaceInstruction(urlIndex, "const-string v$register, \"BOGUS\"")
}
}
}
}

View file

@ -1,6 +1,9 @@
package app.revanced.patches.instagram.misc.disableAnalytics
import app.revanced.patcher.composingFirstMethod
import app.revanced.patcher.gettingFirstMethodDeclaratively
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.strings
@ -8,7 +11,9 @@ internal val BytecodePatchContext.instagramAnalyticsUrlBuilderMethod by gettingF
strings("/logging_client_events")
}
internal const val TARGET_URL = "https://graph.facebook.com/logging_client_events"
internal val BytecodePatchContext.facebookAnalyticsUrlInitMethod by gettingFirstMethodDeclaratively {
strings("analytics_endpoint", TARGET_URL)
internal val BytecodePatchContext.facebookAnalyticsUrlInitMethodMatch by composingFirstMethod {
instructions(
"analytics_endpoint"(),
"https://graph.facebook.com/logging_client_events"()
)
}