Skip to content

Commit 2154d89

Browse files
authored
feat(Instagram): Add Enable developer menu patch (#6043)
1 parent 277a8b6 commit 2154d89

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

patches/api/patches.api

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ public final class app/revanced/patches/instagram/hide/stories/HideStoriesKt {
280280
public static final fun getHideStoriesPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
281281
}
282282

283+
public final class app/revanced/patches/instagram/misc/devmenu/EnableDeveloperMenuPatchKt {
284+
public static final fun getEnableDeveloperMenuPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
285+
}
286+
283287
public final class app/revanced/patches/instagram/misc/extension/SharedExtensionPatchKt {
284288
public static final fun getSharedExtensionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
285289
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package app.revanced.patches.instagram.misc.devmenu
2+
3+
import app.revanced.patcher.patch.bytecodePatch
4+
import app.revanced.util.Utils.trimIndentMultiline
5+
import app.revanced.util.getReference
6+
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
7+
import app.revanced.util.returnEarly
8+
import com.android.tools.smali.dexlib2.Opcode
9+
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
10+
11+
@Suppress("unused")
12+
val enableDeveloperMenuPatch = bytecodePatch(
13+
name = "Enable developer menu",
14+
description = """
15+
Enables the developer menu, which can be found at the bottom of settings menu with name 'Internal Settings'.
16+
17+
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.
18+
""".trimIndentMultiline(),
19+
use = false
20+
) {
21+
compatibleWith("com.instagram.android")
22+
23+
execute {
24+
with(clearNotificationReceiverFingerprint.method) {
25+
indexOfFirstInstructionReversedOrThrow(clearNotificationReceiverFingerprint.stringMatches!!.first().index) {
26+
val reference = getReference<MethodReference>()
27+
Opcode.INVOKE_STATIC == opcode &&
28+
reference?.parameterTypes?.size == 1 &&
29+
reference.parameterTypes.first() == "Lcom/instagram/common/session/UserSession;" &&
30+
reference.returnType == "Z"
31+
}.let { index ->
32+
navigate(this).to(index).stop().returnEarly(true)
33+
}
34+
}
35+
}
36+
}
37+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
package app.revanced.patches.instagram.misc.devmenu
3+
4+
import app.revanced.patcher.fingerprint
5+
6+
internal val clearNotificationReceiverFingerprint = fingerprint {
7+
custom { method, classDef ->
8+
method.name == "onReceive" &&
9+
classDef.type == "Lcom/instagram/notifications/push/ClearNotificationReceiver;"
10+
}
11+
strings("NOTIFICATION_DISMISSED")
12+
}

0 commit comments

Comments
 (0)