generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YouTube): Add
Disable fine scrubbing gesture
patch
- Loading branch information
Showing
4 changed files
with
86 additions
and
27 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
...tlin/app/revanced/patches/youtube/interaction/seekbar/DisableFineScrubbingGesturePatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package app.revanced.patches.youtube.interaction.seekbar | ||
|
||
import app.revanced.extensions.exception | ||
import app.revanced.patcher.data.BytecodeContext | ||
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.patches.shared.settings.preference.impl.StringResource | ||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference | ||
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.IsSwipingUpFingerprint | ||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch | ||
import app.revanced.patches.youtube.misc.settings.SettingsPatch | ||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction | ||
|
||
@Patch( | ||
name = "Disable fine scrubbing gesture", | ||
description = "Disables gesture that shows the fine scrubbing overlay when swiping up on the seekbar.", | ||
dependencies = [IntegrationsPatch::class, SettingsPatch::class], | ||
compatiblePackages = [ | ||
CompatiblePackage( | ||
"com.google.android.youtube", | ||
[ | ||
"18.32.39", | ||
"18.37.36" | ||
] | ||
) | ||
] | ||
) | ||
@Suppress("unused") | ||
object DisableFineScrubbingGesturePatch : BytecodePatch( | ||
setOf(IsSwipingUpFingerprint) | ||
) { | ||
private const val INTEGRATIONS_METHOD_DESCRIPTOR = | ||
"Lapp/revanced/integrations/patches/DisableFineScrubbingGesturePatch;->" + | ||
"disableGesture(Landroid/view/VelocityTracker;Landroid/view/MotionEvent;)V" | ||
|
||
override fun execute(context: BytecodeContext) { | ||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences( | ||
SwitchPreference( | ||
"revanced_disable_fine_scrubbing_gesture", | ||
StringResource("revanced_disable_fine_scrubbing_gesture_title", "Disable fine scrubbing gesture"), | ||
StringResource("revanced_disable_fine_scrubbing_gesture_summary_on", "Gesture is disabled"), | ||
StringResource("revanced_disable_fine_scrubbing_gesture_summary_off", "Gesture is enabled"), | ||
) | ||
) | ||
|
||
IsSwipingUpFingerprint.result?.let { | ||
val addMovementIndex = it.scanResult.patternScanResult!!.startIndex - 1 | ||
|
||
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
...lin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingResourcePatch.kt
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
...n/app/revanced/patches/youtube/interaction/seekbar/fingerprints/IsSwipingUpFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package app.revanced.patches.youtube.interaction.seekbar.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
object IsSwipingUpFingerprint : MethodFingerprint( | ||
parameters = listOf("Landroid/view/MotionEvent;", "J"), | ||
opcodes = listOf(Opcode.SGET_OBJECT) | ||
) |