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

View file

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