feat(Instagram): Add Enable developer menu patch (#6043)

This commit is contained in:
brosssh
2025-10-07 14:37:20 +02:00
committed by GitHub
parent 277a8b6b47
commit 2154d89242
3 changed files with 53 additions and 0 deletions

View File

@@ -280,6 +280,10 @@ public final class app/revanced/patches/instagram/hide/stories/HideStoriesKt {
public static final fun getHideStoriesPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/instagram/misc/devmenu/EnableDeveloperMenuPatchKt {
public static final fun getEnableDeveloperMenuPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/instagram/misc/extension/SharedExtensionPatchKt {
public static final fun getSharedExtensionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}

View File

@@ -0,0 +1,37 @@
package app.revanced.patches.instagram.misc.devmenu
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.Utils.trimIndentMultiline
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
import app.revanced.util.returnEarly
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Suppress("unused")
val enableDeveloperMenuPatch = bytecodePatch(
name = "Enable developer menu",
description = """
Enables the developer menu, which can be found at the bottom of settings menu with name 'Internal Settings'.
It is recommended to use this patch with an alpha/beta Instagram release. Patching a stable release works, but the developer menu shows the developer flags as numbers and does not show a human readable description.
""".trimIndentMultiline(),
use = false
) {
compatibleWith("com.instagram.android")
execute {
with(clearNotificationReceiverFingerprint.method) {
indexOfFirstInstructionReversedOrThrow(clearNotificationReceiverFingerprint.stringMatches!!.first().index) {
val reference = getReference<MethodReference>()
Opcode.INVOKE_STATIC == opcode &&
reference?.parameterTypes?.size == 1 &&
reference.parameterTypes.first() == "Lcom/instagram/common/session/UserSession;" &&
reference.returnType == "Z"
}.let { index ->
navigate(this).to(index).stop().returnEarly(true)
}
}
}
}

View File

@@ -0,0 +1,12 @@
package app.revanced.patches.instagram.misc.devmenu
import app.revanced.patcher.fingerprint
internal val clearNotificationReceiverFingerprint = fingerprint {
custom { method, classDef ->
method.name == "onReceive" &&
classDef.type == "Lcom/instagram/notifications/push/ClearNotificationReceiver;"
}
strings("NOTIFICATION_DISMISSED")
}