mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-28 18:45:48 +01:00
feat(YouTube - Disable precise seeking gesture): Hide "pull up" label that shows up when swiping (#3668)
Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
84f6d12185
commit
3fa8af9fe5
@ -1,18 +1,20 @@
|
||||
package app.revanced.patches.youtube.interaction.seekbar
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.IsSwipingUpFingerprint
|
||||
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.AllowSwipingUpGestureFingerprint
|
||||
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.ShowSwipingUpGuideFingerprint
|
||||
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SwipingUpGestureParentFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import app.revanced.util.alsoResolve
|
||||
|
||||
@Patch(
|
||||
name = "Disable precise seeking gesture",
|
||||
@ -52,11 +54,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
)
|
||||
@Suppress("unused")
|
||||
object DisablePreciseSeekingGesturePatch : BytecodePatch(
|
||||
setOf(IsSwipingUpFingerprint)
|
||||
setOf(SwipingUpGestureParentFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_METHOD_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/youtube/patches/DisablePreciseSeekingGesturePatch;->" +
|
||||
"disableGesture(Landroid/view/VelocityTracker;Landroid/view/MotionEvent;)V"
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/youtube/patches/DisablePreciseSeekingGesturePatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
AddResourcesPatch(this::class)
|
||||
@ -65,19 +66,37 @@ object DisablePreciseSeekingGesturePatch : BytecodePatch(
|
||||
SwitchPreference("revanced_disable_precise_seeking_gesture")
|
||||
)
|
||||
|
||||
IsSwipingUpFingerprint.result?.let {
|
||||
val addMovementIndex = it.scanResult.patternScanResult!!.startIndex - 1
|
||||
AllowSwipingUpGestureFingerprint.alsoResolve(
|
||||
context,
|
||||
SwipingUpGestureParentFingerprint
|
||||
).mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->isGestureDisabled()Z
|
||||
move-result v0
|
||||
if-eqz v0, :disabled
|
||||
return-void
|
||||
""",
|
||||
ExternalLabel("disabled", getInstruction(0))
|
||||
)
|
||||
}
|
||||
|
||||
it.mutableMethod.apply {
|
||||
val addMovementInstruction = getInstruction<FiveRegisterInstruction>(addMovementIndex)
|
||||
val trackerRegister = addMovementInstruction.registerC
|
||||
val eventRegister = addMovementInstruction.registerD
|
||||
|
||||
replaceInstruction(
|
||||
addMovementIndex,
|
||||
"invoke-static {v$trackerRegister, v$eventRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR"
|
||||
)
|
||||
}
|
||||
} ?: throw IsSwipingUpFingerprint.exception
|
||||
ShowSwipingUpGuideFingerprint.alsoResolve(
|
||||
context,
|
||||
SwipingUpGestureParentFingerprint
|
||||
).mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->isGestureDisabled()Z
|
||||
move-result v0
|
||||
if-eqz v0, :disabled
|
||||
const/4 v0, 0x0
|
||||
return v0
|
||||
""",
|
||||
ExternalLabel("disabled", getInstruction(0))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package app.revanced.patches.youtube.interaction.seekbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
/**
|
||||
* Resolves using the class found in [SwipingUpGestureParentFingerprint].
|
||||
*/
|
||||
internal object AllowSwipingUpGestureFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
returnType = "V",
|
||||
parameters = listOf("L"),
|
||||
)
|
@ -1,13 +0,0 @@
|
||||
package app.revanced.patches.youtube.interaction.seekbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object IsSwipingUpFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
parameters = listOf("Landroid/view/MotionEvent;", "J"),
|
||||
opcodes = listOf(
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IGET_OBJECT
|
||||
)
|
||||
)
|
@ -0,0 +1,14 @@
|
||||
package app.revanced.patches.youtube.interaction.seekbar.fingerprints
|
||||
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
/**
|
||||
* Resolves using the class found in [SwipingUpGestureParentFingerprint].
|
||||
*/
|
||||
internal object ShowSwipingUpGuideFingerprint : LiteralValueFingerprint(
|
||||
accessFlags = AccessFlags.FINAL.value,
|
||||
returnType = "Z",
|
||||
parameters = emptyList(),
|
||||
literalSupplier = { 1L }
|
||||
)
|
@ -0,0 +1,12 @@
|
||||
package app.revanced.patches.youtube.interaction.seekbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object SwipingUpGestureParentFingerprint : LiteralValueFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
returnType = "Z",
|
||||
parameters = listOf(),
|
||||
literalSupplier = { 45379021 }
|
||||
)
|
Loading…
Reference in New Issue
Block a user