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