feat(GitHub): Add Pinch to zoom patch

This commit is contained in:
oSumAtrIX 2023-11-15 00:06:22 +01:00
parent 19f3faa1f2
commit adc8cc6d5c
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
2 changed files with 33 additions and 0 deletions

View file

@ -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
}

View file

@ -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;")
)