fix(hide-time-and-seekbar): don't draw the seekbar (#594)

This commit is contained in:
OxrxL 2022-09-23 12:51:58 +02:00 committed by GitHub
parent d60727d32a
commit 46e0195f76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 46 deletions

View file

@ -1,35 +0,0 @@
package app.revanced.patches.youtube.layout.hidetimeandseekbar.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.hidetimeandseekbar.annotations.HideTimeAndSeekbarCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("inline-time-bar-wrapper-fingerprint")
@MatchingMethod("Lcom/google/android/apps/youtube/app/common/player/overlay/InlineTimeBarWrapper;", "onLayout")
@FuzzyPatternScanMethod(3)
@HideTimeAndSeekbarCompatibility
@Version("0.0.1")
object InlineTimeBarWrapperFingerprint : MethodFingerprint(
"V", AccessFlags.PROTECTED or AccessFlags.FINAL, listOf("Z", "I", "I", "I", "I"), listOf(
Opcode.SUB_INT_2ADDR,
Opcode.SUB_INT,
Opcode.IF_EQZ,
Opcode.IF_NEZ,
Opcode.GOTO_16,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.SUB_INT,
Opcode.CONST_4,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,
Opcode.IGET_OBJECT,
)
)

View file

@ -11,16 +11,22 @@ import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("time-counter-fingerprint") @Name("time-counter-fingerprint")
@MatchingMethod("Lfez", "a") @MatchingMethod("Lfga", "pk")
@FuzzyPatternScanMethod(3) @FuzzyPatternScanMethod(3)
@HideTimeAndSeekbarCompatibility @HideTimeAndSeekbarCompatibility
@Version("0.0.1") @Version("0.0.1")
object TimeCounterFingerprint : MethodFingerprint( object TimeCounterFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("J"), listOf( "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
Opcode.SGET_OBJECT, Opcode.IGET_OBJECT,
Opcode.IGET_WIDE,
Opcode.CONST_WIDE_16, Opcode.CONST_WIDE_16,
Opcode.ADD_LONG_2ADDR, Opcode.CMP_LONG,
Opcode.IF_LEZ,
Opcode.IGET_OBJECT,
Opcode.IF_EQZ,
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_WIDE, Opcode.MOVE_RESULT,
Opcode.IF_EQZ,
Opcode.GOTO,
) )
) )

View file

@ -10,9 +10,10 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.layout.hidetimeandseekbar.fingerprints.InlineTimeBarWrapperFingerprint import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingFingerprint
import app.revanced.patches.youtube.layout.hidetimeandseekbar.fingerprints.TimeCounterFingerprint import app.revanced.patches.youtube.layout.hidetimeandseekbar.fingerprints.TimeCounterFingerprint
import app.revanced.patches.youtube.layout.hidetimeandseekbar.annotations.HideTimeAndSeekbarCompatibility import app.revanced.patches.youtube.layout.hidetimeandseekbar.annotations.HideTimeAndSeekbarCompatibility
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.CreateVideoPlayerSeekbarFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
@ -26,7 +27,7 @@ import app.revanced.patches.youtube.misc.settings.framework.components.impl.Swit
@Version("0.0.1") @Version("0.0.1")
class HideTimeAndSeekbarPatch : BytecodePatch( class HideTimeAndSeekbarPatch : BytecodePatch(
listOf( listOf(
InlineTimeBarWrapperFingerprint, TimeCounterFingerprint CreateVideoPlayerSeekbarFingerprint, SeekbarTappingFingerprint, TimeCounterFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
@ -40,10 +41,11 @@ class HideTimeAndSeekbarPatch : BytecodePatch(
) )
) )
val inlineTimeBarWrapperMethod = InlineTimeBarWrapperFingerprint.result!!.mutableMethod val createVideoPlayerSeekbarMethod = CreateVideoPlayerSeekbarFingerprint.result!!.mutableMethod
inlineTimeBarWrapperMethod.addInstructions( createVideoPlayerSeekbarMethod.addInstructions(
0, """ 0, """
const/4 v0, 0x0
invoke-static { }, Lapp/revanced/integrations/patches/HideTimeAndSeekbarPatch;->hideTimeAndSeekbar()Z invoke-static { }, Lapp/revanced/integrations/patches/HideTimeAndSeekbarPatch;->hideTimeAndSeekbar()Z
move-result v0 move-result v0
if-eqz v0, :hide_time_and_seekbar if-eqz v0, :hide_time_and_seekbar
@ -53,6 +55,20 @@ class HideTimeAndSeekbarPatch : BytecodePatch(
""" """
) )
val seekbarTappingMethod = SeekbarTappingFingerprint.result!!.mutableMethod
seekbarTappingMethod.addInstructions(
0, """
invoke-static { }, Lapp/revanced/integrations/patches/HideTimeAndSeekbarPatch;->hideTimeAndSeekbar()Z
move-result v0
if-eqz v0, :hide_time_and_seekbar
const/4 v0, 0x0
return v0
:hide_time_and_seekbar
nop
"""
)
val timeCounterMethod = TimeCounterFingerprint.result!!.mutableMethod val timeCounterMethod = TimeCounterFingerprint.result!!.mutableMethod
timeCounterMethod.addInstructions( timeCounterMethod.addInstructions(
@ -60,8 +76,7 @@ class HideTimeAndSeekbarPatch : BytecodePatch(
invoke-static { }, Lapp/revanced/integrations/patches/HideTimeAndSeekbarPatch;->hideTimeAndSeekbar()Z invoke-static { }, Lapp/revanced/integrations/patches/HideTimeAndSeekbarPatch;->hideTimeAndSeekbar()Z
move-result v0 move-result v0
if-eqz v0, :hide_time_and_seekbar if-eqz v0, :hide_time_and_seekbar
const-string v0, "" return-void
return-object v0
:hide_time_and_seekbar :hide_time_and_seekbar
nop nop
""" """