fix(Instagram): Fix Download media and Enable location sticker redesign patches

- Use composingFirstMethod with instructions() instead of gettingFirstMethodDeclaratively
- Use returnEarly() without value for methods with non-boolean return types

All 21 Instagram patches now work with version 421.0.0.51.66
This commit is contained in:
Gaurav 2026-03-22 02:05:54 +05:45
parent d852728589
commit 9e8193e4d7
4 changed files with 30 additions and 25 deletions

View file

@ -12,6 +12,6 @@ val downloadMediaPatch = bytecodePatch(
compatibleWith("com.instagram.android") compatibleWith("com.instagram.android")
apply { apply {
downloadAllowedMethod.returnEarly(true) downloadAllowedMethodMatch.method.returnEarly()
} }
} }

View file

@ -1,6 +1,10 @@
package app.revanced.patches.instagram.misc.download package app.revanced.patches.instagram.misc.download
import app.revanced.patcher.gettingFirstMethodDeclaratively import app.revanced.patcher.composingFirstMethod
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.patch.BytecodePatchContext import app.revanced.patcher.patch.BytecodePatchContext
internal val BytecodePatchContext.downloadAllowedMethod by gettingFirstMethodDeclaratively("clips_download_allowed_toggle_auto") internal val BytecodePatchContext.downloadAllowedMethodMatch by composingFirstMethod {
instructions("clips_download_allowed_toggle_auto"())
}

View file

@ -1,20 +1,17 @@
package app.revanced.patches.instagram.story.locationsticker package app.revanced.patches.instagram.story.locationsticker
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly import app.revanced.util.returnEarly
@Suppress("unused") @Suppress("unused")
val enableLocationStickerRedesignPatch = bytecodePatch( val enableLocationStickerRedesignPatch = bytecodePatch(
name = "Enable location sticker redesign", name = "Enable location sticker redesign",
description = "Unlocks the redesigned location sticker with additional style options.", description = "Unlocks the redesigned location sticker with additional style options.",
use = false, use = false,
) { ) {
compatibleWith("com.instagram.android") compatibleWith("com.instagram.android")
apply { apply {
// The gate method reads a MobileConfig boolean flag and returns it directly. locationStickerRedesignGateMethodMatch.method.returnEarly()
// Returning early with true bypasses the flag check entirely, }
// enabling the redesigned sticker styles regardless of server configuration. }
locationStickerRedesignGateMethod.returnEarly(true)
}
}

View file

@ -1,6 +1,10 @@
package app.revanced.patches.instagram.story.locationsticker package app.revanced.patches.instagram.story.locationsticker
import app.revanced.patcher.gettingFirstMethodDeclaratively import app.revanced.patcher.composingFirstMethod
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.patch.BytecodePatchContext import app.revanced.patcher.patch.BytecodePatchContext
internal val BytecodePatchContext.locationStickerRedesignGateMethod by gettingFirstMethodDeclaratively("map_location_sticker_fragment") internal val BytecodePatchContext.locationStickerRedesignGateMethodMatch by composingFirstMethod {
instructions("location_sticker_redesign_default"())
}