mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-01 07:04:30 +02:00
feat(YouTube/Hide seek message): now the seek undo message (Release to cancel
) is also hidden
This commit is contained in:
parent
6aac335c40
commit
cd3b879fdb
@ -9,13 +9,20 @@ 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.youtube.player.seekmessage.fingerprints.SeekEduContainerFingerprint
|
||||
import app.revanced.patches.youtube.player.seekmessage.fingerprints.SeekEduUndoOverlayFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.SeekUndoEduOverlayStub
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.PLAYER
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch(
|
||||
name = "Hide seek message",
|
||||
description = "Hides the 'Slide left or right to seek' message container.",
|
||||
description = "Hides the 'Slide left or right to seek' or 'Release to cancel' message container.",
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
@ -44,7 +51,10 @@ import app.revanced.util.integrations.Constants.PLAYER
|
||||
)
|
||||
@Suppress("unused")
|
||||
object SeekMessagePatch : BytecodePatch(
|
||||
setOf(SeekEduContainerFingerprint)
|
||||
setOf(
|
||||
SeekEduContainerFingerprint,
|
||||
SeekEduUndoOverlayFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
@ -61,6 +71,35 @@ object SeekMessagePatch : BytecodePatch(
|
||||
}
|
||||
} ?: throw SeekEduContainerFingerprint.exception
|
||||
|
||||
/**
|
||||
* Added in YouTube v18.29.xx~
|
||||
*/
|
||||
SeekEduUndoOverlayFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getWideLiteralIndex(SeekUndoEduOverlayStub)
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
for (index in insertIndex until implementation!!.instructions.size) {
|
||||
val targetInstruction = getInstruction(index)
|
||||
if (targetInstruction.opcode != Opcode.INVOKE_VIRTUAL)
|
||||
continue
|
||||
|
||||
if (((targetInstruction as Instruction35c).reference as MethodReference).name != "setOnClickListener")
|
||||
continue
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $PLAYER->hideSeekMessage()Z
|
||||
move-result v$insertRegister
|
||||
if-nez v$insertRegister, :default
|
||||
""", ExternalLabel("default", getInstruction(index + 1))
|
||||
)
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
|
@ -0,0 +1,10 @@
|
||||
package app.revanced.patches.youtube.player.seekmessage.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.SeekUndoEduOverlayStub
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object SeekEduUndoOverlayFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(SeekUndoEduOverlayStub) }
|
||||
)
|
@ -72,6 +72,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
var RightComment: Long = -1
|
||||
var ScrimOverlay: Long = -1
|
||||
var Scrubbing: Long = -1
|
||||
var SeekUndoEduOverlayStub: Long = -1
|
||||
var SettingsBooleanTimeRangeDialog: Long = -1
|
||||
var SpeedOverlayText: Long = -1
|
||||
var SubtitleMenuSettingsFooterInfo: Long = -1
|
||||
@ -153,6 +154,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
RightComment = find(DRAWABLE, "ic_right_comment_32c")
|
||||
ScrimOverlay = find(ID, "scrim_overlay")
|
||||
Scrubbing = find(DIMEN, "vertical_touch_offset_to_enter_fine_scrubbing")
|
||||
SeekUndoEduOverlayStub = find(ID, "seek_undo_edu_overlay_stub")
|
||||
SettingsBooleanTimeRangeDialog = find(LAYOUT, "setting_boolean_time_range_dialog")
|
||||
SpeedOverlayText = find(ID, "speedmaster_edu_text")
|
||||
SubtitleMenuSettingsFooterInfo = find(STRING, "subtitle_menu_settings_footer_info")
|
||||
|
Loading…
x
Reference in New Issue
Block a user