Skip to content

Commit

Permalink
fix(hide-time-and-seekbar): don't draw the seekbar (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
OxrxL committed Sep 23, 2022
1 parent 8276282 commit 4a4f883
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 46 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -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
Expand All @@ -53,15 +55,28 @@ 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(
0, """
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
"""
Expand Down

0 comments on commit 4a4f883

Please sign in to comment.