From 46e0195f760dc11ec8d2068ffb57997eccab1aff Mon Sep 17 00:00:00 2001 From: OxrxL <108184954+OxrxL@users.noreply.github.com> Date: Fri, 23 Sep 2022 12:51:58 +0200 Subject: [PATCH] fix(hide-time-and-seekbar): don't draw the seekbar (#594) --- .../InlineTimeBarWrapperFingerprint.kt | 35 ------------------- .../fingerprints/TimeCounterFingerprint.kt | 16 ++++++--- .../patch/HideTimeAndSeekbarPatch.kt | 27 ++++++++++---- 3 files changed, 32 insertions(+), 46 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/fingerprints/InlineTimeBarWrapperFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/fingerprints/InlineTimeBarWrapperFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/fingerprints/InlineTimeBarWrapperFingerprint.kt deleted file mode 100644 index f830b9e1e..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/fingerprints/InlineTimeBarWrapperFingerprint.kt +++ /dev/null @@ -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, - ) -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/fingerprints/TimeCounterFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/fingerprints/TimeCounterFingerprint.kt index 21c0e9d35..c0a7a3c29 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/fingerprints/TimeCounterFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/fingerprints/TimeCounterFingerprint.kt @@ -11,16 +11,22 @@ import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode @Name("time-counter-fingerprint") -@MatchingMethod("Lfez", "a") +@MatchingMethod("Lfga", "pk") @FuzzyPatternScanMethod(3) @HideTimeAndSeekbarCompatibility @Version("0.0.1") object TimeCounterFingerprint : MethodFingerprint( - "L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("J"), listOf( - Opcode.SGET_OBJECT, + "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf( + Opcode.IGET_OBJECT, + Opcode.IGET_WIDE, Opcode.CONST_WIDE_16, - Opcode.ADD_LONG_2ADDR, + Opcode.CMP_LONG, + Opcode.IF_LEZ, + Opcode.IGET_OBJECT, + Opcode.IF_EQZ, Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_WIDE, + Opcode.MOVE_RESULT, + Opcode.IF_EQZ, + Opcode.GOTO, ) ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/patch/HideTimeAndSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/patch/HideTimeAndSeekbarPatch.kt index 75e82fd6d..f0c056ae8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/patch/HideTimeAndSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/patch/HideTimeAndSeekbarPatch.kt @@ -10,9 +10,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch 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.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.settings.bytecode.patch.SettingsPatch 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") class HideTimeAndSeekbarPatch : BytecodePatch( listOf( - InlineTimeBarWrapperFingerprint, TimeCounterFingerprint + CreateVideoPlayerSeekbarFingerprint, SeekbarTappingFingerprint, TimeCounterFingerprint ) ) { 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, """ + const/4 v0, 0x0 invoke-static { }, Lapp/revanced/integrations/patches/HideTimeAndSeekbarPatch;->hideTimeAndSeekbar()Z move-result v0 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 timeCounterMethod.addInstructions( @@ -60,8 +76,7 @@ class HideTimeAndSeekbarPatch : BytecodePatch( invoke-static { }, Lapp/revanced/integrations/patches/HideTimeAndSeekbarPatch;->hideTimeAndSeekbar()Z move-result v0 if-eqz v0, :hide_time_and_seekbar - const-string v0, "" - return-object v0 + return-void :hide_time_and_seekbar nop """