From c297601a49fc780d75462494a8d6139efa5ab319 Mon Sep 17 00:00:00 2001 From: inotia00 Date: Wed, 22 Feb 2023 23:35:37 +0900 Subject: [PATCH] remove `hide-time-and-seekbar` patch --- .../fingerprints/TimeCounterFingerprint.kt | 15 ---- .../TimeCounterParentFingerprint.kt | 19 ----- .../patch/HideTimeAndSeekbarPatch.kt | 78 ------------------- .../resourceid/patch/SharedResourceIdPatch.kt | 2 - .../youtube/settings/xml/revanced_prefs.xml | 3 - 5 files changed, 117 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/fingerprints/TimeCounterFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/fingerprints/TimeCounterParentFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/patch/HideTimeAndSeekbarPatch.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/fingerprints/TimeCounterFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/fingerprints/TimeCounterFingerprint.kt deleted file mode 100644 index 65ffe48dc..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/fingerprints/TimeCounterFingerprint.kt +++ /dev/null @@ -1,15 +0,0 @@ -package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.AccessFlags -import org.jf.dexlib2.Opcode - -object TimeCounterFingerprint : MethodFingerprint( - returnType = "V", - access = AccessFlags.PUBLIC or AccessFlags.FINAL, - opcodes = listOf( - Opcode.CONST_WIDE_16, - Opcode.CMP_LONG - ) -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/fingerprints/TimeCounterParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/fingerprints/TimeCounterParentFingerprint.kt deleted file mode 100644 index 77e310880..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/fingerprints/TimeCounterParentFingerprint.kt +++ /dev/null @@ -1,19 +0,0 @@ -package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import org.jf.dexlib2.AccessFlags -import org.jf.dexlib2.Opcode -import org.jf.dexlib2.iface.instruction.WideLiteralInstruction - -object TimeCounterParentFingerprint : MethodFingerprint( - returnType = "V", - access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, - customFingerprint = { methodDef -> - methodDef.implementation?.instructions?.any { - it.opcode.ordinal == Opcode.CONST.ordinal && - (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.timebarColorLabelId - } == true - } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/patch/HideTimeAndSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/patch/HideTimeAndSeekbarPatch.kt deleted file mode 100644 index d4af4545a..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/timeandseekbar/patch/HideTimeAndSeekbarPatch.kt +++ /dev/null @@ -1,78 +0,0 @@ -package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.patch - -import app.revanced.extensions.toErrorResult -import app.revanced.patcher.annotation.Description -import app.revanced.patcher.annotation.Name -import app.revanced.patcher.annotation.Version -import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.addInstructions -import app.revanced.patcher.extensions.instruction -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.patches.shared.annotation.YouTubeCompatibility -import app.revanced.patches.youtube.layout.seekbar.timeandseekbar.fingerprints.TimeCounterFingerprint -import app.revanced.patches.youtube.layout.seekbar.timeandseekbar.fingerprints.TimeCounterParentFingerprint -import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch -import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.patches.youtube.misc.timebar.patch.HookTimebarPatch -import app.revanced.util.integrations.Constants.SEEKBAR_LAYOUT - -@Patch -@Name("hide-time-and-seekbar") -@Description("Hides progress bar and time counter on videos.") -@DependsOn( - [ - HookTimebarPatch::class, - SettingsPatch::class, - SharedResourcdIdPatch::class - ] -) -@YouTubeCompatibility -@Version("0.0.1") -class HideTimeAndSeekbarPatch : BytecodePatch( - listOf( - TimeCounterParentFingerprint - ) -) { - override fun execute(context: BytecodeContext): PatchResult { - - TimeCounterParentFingerprint.result?.let { parentResult -> - TimeCounterFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.let { method -> - listOf( - HookTimebarPatch.setTimebarMethod, - method - ).forEach { - it.addInstructions( - 0, """ - invoke-static {}, $SEEKBAR_LAYOUT->hideTimeAndSeekbar()Z - move-result v0 - if-eqz v0, :hide_time_and_seekbar - return-void - """, listOf(ExternalLabel("hide_time_and_seekbar", it.instruction(0))) - ) - } - - } ?: return TimeCounterFingerprint.toErrorResult() - } ?: return TimeCounterParentFingerprint.toErrorResult() - - /* - * Add settings - */ - SettingsPatch.addPreference( - arrayOf( - "PREFERENCE: OTHER_LAYOUT_SETTINGS", - "PREFERENCE_HEADER: SEEKBAR", - "SETTINGS: HIDE_TIME_AND_SEEKBAR" - ) - ) - - SettingsPatch.updatePatchStatus("hide-time-and-seekbar") - - return PatchResultSuccess() - } -} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt index 5976a4253..4b7288cc9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt @@ -35,7 +35,6 @@ class SharedResourcdIdPatch : ResourcePatch { var layoutVideo: Long = -1 var liveChatButtonId: Long = -1 var scrubbingLabelId: Long = -1 - var timebarColorLabelId: Long = -1 var tooltipLabelId: Long = -1 var videoqualityfragmentLabelId: Long = -1 } @@ -65,7 +64,6 @@ class SharedResourcdIdPatch : ResourcePatch { layoutVideo = findSharedResourceId("layout", "endscreen_element_layout_video") liveChatButtonId = findSharedResourceId("id", "live_chat_overlay_button") scrubbingLabelId = findSharedResourceId("dimen", "vertical_touch_offset_to_enter_fine_scrubbing") - timebarColorLabelId = findSharedResourceId("color", "inline_time_bar_progress_color") tooltipLabelId = findSharedResourceId("layout", "tooltip_content_view") videoqualityfragmentLabelId = findSharedResourceId("layout", "video_quality_bottom_sheet_list_fragment_title") diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 363ad1fb3..ffb506eb5 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -284,8 +284,6 @@ - @@ -420,7 +418,6 @@ -