diff --git a/src/main/kotlin/app/revanced/patches/github/misc.gestures/PinchToZoomPatch.kt b/src/main/kotlin/app/revanced/patches/github/misc.gestures/PinchToZoomPatch.kt new file mode 100644 index 000000000..e65e505dc --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/github/misc.gestures/PinchToZoomPatch.kt @@ -0,0 +1,26 @@ +package app.revanced.patches.github.misc.gestures + +import app.revanced.extensions.exception +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.InstructionExtensions.addInstruction +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.github.misc.gestures.fingerprints.CodeViewFingerprint + +@Patch( + name = "Pinch to zoom", + description = "Adds pinch to zoom functionality to the code viewer.", + compatiblePackages = [CompatiblePackage("com.github.android")], + requiresIntegrations = true +) +@Suppress("unused") +object PinchToZoomPatch : BytecodePatch( + setOf(CodeViewFingerprint) +) { + override fun execute(context: BytecodeContext) = CodeViewFingerprint.result?.mutableMethod?.addInstruction( + 0, + "invoke-static { p2 }, Lapp/revanced/github/PinchToZoomPatch;->" + + "addPinchToZoomGesture(Landroid/view/ViewGroup;)V" + ) ?: throw CodeViewFingerprint.exception +} diff --git a/src/main/kotlin/app/revanced/patches/github/misc.gestures/fingerprints/CodeViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/github/misc.gestures/fingerprints/CodeViewFingerprint.kt new file mode 100644 index 000000000..4f324bc4a --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/github/misc.gestures/fingerprints/CodeViewFingerprint.kt @@ -0,0 +1,7 @@ +package app.revanced.patches.github.misc.gestures.fingerprints + +import app.revanced.patcher.fingerprint.MethodFingerprint + +object CodeViewFingerprint : MethodFingerprint( + parameters = listOf("Landroid/view/ViewGroup;", "Landroidx/recyclerview/widget/RecyclerView;") +) \ No newline at end of file