feat(Instagram): Add Disable Reels scrolling patch (#6317)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
Alexey Gorbachev
2025-12-08 11:31:54 +00:00
committed by GitHub
parent bbd8932b2e
commit 0928dcd00d
3 changed files with 51 additions and 0 deletions

View File

@@ -1,3 +1,7 @@
public final class DisableReelsScrollingPatchKt {
public static final fun getDisableReelsScrollingPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/all/misc/activity/exportall/ExportAllActivitiesPatchKt {
public static final fun getExportAllActivitiesPatch ()Lapp/revanced/patcher/patch/ResourcePatch;
}

View File

@@ -0,0 +1,34 @@
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.instagram.reels.clipsSwipeRefreshLayoutOnInterceptTouchEventFingerprint
import app.revanced.patches.instagram.reels.clipsViewPagerImplGetViewAtIndexFingerprint
import app.revanced.util.returnEarly
@Suppress("unused")
val disableReelsScrollingPatch = bytecodePatch(
name = "Disable Reels scrolling",
description = "Disables the endless scrolling behavior in Instagram Reels, preventing swiping to the next Reel. " +
"Note: On a clean install, the 'Tip' animation may appear but will stop on its own after a few seconds.",
use = true
) {
compatibleWith("com.instagram.android")
execute {
val viewPagerField = clipsViewPagerImplGetViewAtIndexFingerprint.classDef.fields.first {
it.type == "Landroidx/viewpager2/widget/ViewPager2;"
}
// Disable user input on the ViewPager2 to prevent scrolling.
clipsViewPagerImplGetViewAtIndexFingerprint.method.addInstructions(
0,
"""
iget-object v0, p0, $viewPagerField
const/4 v1, 0x0
invoke-virtual { v0, v1 }, Landroidx/viewpager2/widget/ViewPager2;->setUserInputEnabled(Z)V
"""
)
// Return false in onInterceptTouchEvent to disable pull-to-refresh.
clipsSwipeRefreshLayoutOnInterceptTouchEventFingerprint.method.returnEarly(false)
}
}

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.instagram.reels
import app.revanced.patcher.fingerprint
internal val clipsViewPagerImplGetViewAtIndexFingerprint = fingerprint {
strings("ClipsViewPagerImpl_getViewAtIndex")
}
internal val clipsSwipeRefreshLayoutOnInterceptTouchEventFingerprint = fingerprint {
parameters("Landroid/view/MotionEvent;")
custom { _, classDef -> classDef.type == "Linstagram/features/clips/viewer/ui/ClipsSwipeRefreshLayout;" }
}