From b8629aacb63a3e7ec710a441281c00245c9770d7 Mon Sep 17 00:00:00 2001 From: PainfulPaladins <122171814+PainfulPaladins@users.noreply.github.com> Date: Sat, 6 Sep 2025 13:53:08 +0300 Subject: [PATCH] feat(Instagram): Add `Hide Stories from Home` patch (#5756) --- .../instagram/hide/stories/Fingerprints.kt | 17 ++++++++++++++++ .../instagram/hide/stories/HideStories.kt | 20 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/Fingerprints.kt create mode 100644 patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/HideStories.kt diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/Fingerprints.kt new file mode 100644 index 000000000..3b58aa8c2 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/Fingerprints.kt @@ -0,0 +1,17 @@ +package app.revanced.patches.instagram.hide.stories +import app.revanced.patcher.fingerprint +import com.android.tools.smali.dexlib2.Opcode + + +internal val getOrCreateAvatarViewFingerprint = fingerprint { + parameters() + returns("L") + custom { method, classDef -> + classDef.type == "Lcom/instagram/reels/ui/views/reelavatar/RecyclerReelAvatarView;" + } + opcodes( + Opcode.INVOKE_VIRTUAL, + Opcode.IPUT_OBJECT, + Opcode.INVOKE_VIRTUAL // Add View (Story) + ) + } diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/HideStories.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/HideStories.kt new file mode 100644 index 000000000..65c51cf36 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/HideStories.kt @@ -0,0 +1,20 @@ +package app.revanced.patches.instagram.hide.stories +import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction +import app.revanced.patcher.patch.bytecodePatch + +@Suppress("unused") +val hideStoriesPatch = bytecodePatch( + name = "Hide Stories from Home", + description = "Hides Stories from the main page, by removing the buttons.", + use = false +) { + compatibleWith("com.instagram.android") + + execute { + val addStoryMethod = getOrCreateAvatarViewFingerprint.method // Creates Story + val addStoryEndIndex = getOrCreateAvatarViewFingerprint.patternMatch!!.endIndex + + // Remove addView of Story. + addStoryMethod.removeInstruction(addStoryEndIndex) + } +} \ No newline at end of file