feat(YouTube): integrate Hide double tap overlay filter patch into the Player components patch

This commit is contained in:
inotia00 2024-06-27 23:36:41 +09:00
parent 2683e6bdde
commit 7c9261f3ce
6 changed files with 47 additions and 27 deletions

View File

@ -1,26 +0,0 @@
package app.revanced.patches.youtube.layout.doubletapbackground
import app.revanced.patcher.data.ResourceContext
import app.revanced.patches.shared.overlaybackground.OverlayBackgroundUtils.removeOverlayBackground
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.patch.BaseResourcePatch
@Suppress("unused")
object DoubleTapOverlayBackgroundPatch : BaseResourcePatch(
name = "Hide double tap overlay filter",
description = "Removes, at compile time, the dark overlay that appears when double-tapping to seek.",
dependencies = setOf(SettingsPatch::class),
compatiblePackages = COMPATIBLE_PACKAGE,
use = false
) {
override fun execute(context: ResourceContext) {
context.removeOverlayBackground(
arrayOf("quick_seek_overlay.xml"),
arrayOf("tap_bloom_view", "dark_background")
)
SettingsPatch.updatePatchStatus(this)
}
}

View File

@ -20,6 +20,7 @@ import app.revanced.patches.youtube.player.components.fingerprints.InfoCardsInco
import app.revanced.patches.youtube.player.components.fingerprints.LayoutCircleFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.LayoutIconFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.LayoutVideoFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.QuickSeekOverlayFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.SeekEduContainerFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.SuggestedActionsFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.TouchAreaOnClickListenerFingerprint
@ -34,14 +35,18 @@ import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
import app.revanced.patches.youtube.utils.integrations.Constants.PLAYER_CLASS_DESCRIPTOR
import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.DarkBackground
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.FadeDurationFast
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ScrimOverlay
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.SeekUndoEduOverlayStub
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.TapBloomView
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.util.getTargetIndexOrThrow
import app.revanced.util.getTargetIndexReversedOrThrow
import app.revanced.util.getTargetIndexWithMethodReferenceNameOrThrow
import app.revanced.util.getWideLiteralInstructionIndex
import app.revanced.util.literalInstructionViewHook
import app.revanced.util.patch.BaseBytecodePatch
import app.revanced.util.resultOrThrow
import com.android.tools.smali.dexlib2.Opcode
@ -73,6 +78,7 @@ object PlayerComponentsPatch : BaseBytecodePatch(
LayoutCircleFingerprint,
LayoutIconFingerprint,
LayoutVideoFingerprint,
QuickSeekOverlayFingerprint,
SeekEduContainerFingerprint,
SuggestedActionsFingerprint,
TouchAreaOnClickListenerFingerprint,
@ -164,6 +170,24 @@ object PlayerComponentsPatch : BaseBytecodePatch(
// endregion
// region patch for hide double-tap overlay filter
val smaliInstruction = """
invoke-static {v$REGISTER_TEMPLATE_REPLACEMENT}, $PLAYER_CLASS_DESCRIPTOR->hideDoubleTapOverlayFilter(Landroid/view/View;)V
"""
arrayOf(
DarkBackground,
TapBloomView
).forEach { literal ->
QuickSeekOverlayFingerprint.literalInstructionViewHook(
literal,
smaliInstruction
)
}
// endregion
// region patch for hide end screen cards
listOf(

View File

@ -0,0 +1,15 @@
package app.revanced.patches.youtube.player.components.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.DarkBackground
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.TapBloomView
import app.revanced.util.containsWideLiteralInstructionIndex
internal object QuickSeekOverlayFingerprint : MethodFingerprint(
returnType = "V",
parameters = emptyList(),
customFingerprint = { methodDef, _ ->
methodDef.containsWideLiteralInstructionIndex(DarkBackground)
&& methodDef.containsWideLiteralInstructionIndex(TapBloomView)
},
)

View File

@ -39,6 +39,7 @@ object SharedResourceIdPatch : ResourcePatch() {
var CompactLink = -1L
var CompactListItem = -1L
var ControlsLayoutStub = -1L
var DarkBackground = -1L
var DarkSplashAnimation = -1L
var DonationCompanion = -1L
var DrawerContentView = -1L
@ -93,6 +94,7 @@ object SharedResourceIdPatch : ResourcePatch() {
var SlidingDialogAnimation = -1L
var SubtitleMenuSettingsFooterInfo = -1L
var SuggestedAction = -1L
var TapBloomView = -1L
var TitleAnchor = -1L
var ToolTipContentView = -1L
var TotalTime = -1L
@ -132,6 +134,7 @@ object SharedResourceIdPatch : ResourcePatch() {
CompactLink = getId(LAYOUT, "compact_link")
CompactListItem = getId(LAYOUT, "compact_list_item")
ControlsLayoutStub = getId(ID, "controls_layout_stub")
DarkBackground = getId(ID, "dark_background")
DarkSplashAnimation = getId(ID, "dark_splash_animation")
DonationCompanion = getId(LAYOUT, "donation_companion")
DrawerContentView = getId(ID, "drawer_content_view")
@ -189,6 +192,7 @@ object SharedResourceIdPatch : ResourcePatch() {
SlidingDialogAnimation = getId(STYLE, "SlidingDialogAnimation")
SubtitleMenuSettingsFooterInfo = getId(STRING, "subtitle_menu_settings_footer_info")
SuggestedAction = getId(LAYOUT, "suggested_action")
TapBloomView = getId(ID, "tap_bloom_view")
TitleAnchor = getId(ID, "title_anchor")
ToolTipContentView = getId(LAYOUT, "tooltip_content_view")
TotalTime = getId(STRING, "total_time")

View File

@ -520,6 +520,9 @@ Note:
<string name="revanced_hide_crowdfunding_box_title">Hide crowdfunding box</string>
<string name="revanced_hide_crowdfunding_box_summary_on">Crowdfunding box is hidden.</string>
<string name="revanced_hide_crowdfunding_box_summary_off">Crowdfunding box is shown.</string>
<string name="revanced_hide_double_tap_overlay_filter_title">Hide double-tap overlay filter</string>
<string name="revanced_hide_double_tap_overlay_filter_summary_on">Double-tap overlay filter is hidden.</string>
<string name="revanced_hide_double_tap_overlay_filter_summary_off">Double-tap overlay filter is shown.</string>
<string name="revanced_hide_end_screen_cards_title">Hide end screen cards</string>
<string name="revanced_hide_end_screen_cards_summary_on">End screen cards are hidden.</string>
<string name="revanced_hide_end_screen_cards_summary_off">End screen cards are shown.</string>

View File

@ -430,6 +430,7 @@
<app.revanced.integrations.shared.settings.preference.ResettableEditTextPreference android:hint="2.0" android:title="@string/revanced_speed_overlay_value_title" android:key="revanced_speed_overlay_value" android:summary="@string/revanced_speed_overlay_value_summary" android:inputType="numberDecimal" />
<SwitchPreference android:title="@string/revanced_hide_channel_watermark_title" android:key="revanced_hide_channel_watermark" android:summaryOn="@string/revanced_hide_channel_watermark_summary_on" android:summaryOff="@string/revanced_hide_channel_watermark_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_crowdfunding_box_title" android:key="revanced_hide_crowdfunding_box" android:summaryOn="@string/revanced_hide_crowdfunding_box_summary_on" android:summaryOff="@string/revanced_hide_crowdfunding_box_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_double_tap_overlay_filter_title" android:key="revanced_hide_double_tap_overlay_filter" android:summaryOn="@string/revanced_hide_double_tap_overlay_filter_summary_on" android:summaryOff="@string/revanced_hide_double_tap_overlay_filter_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_end_screen_cards_title" android:key="revanced_hide_end_screen_cards" android:summaryOn="@string/revanced_hide_end_screen_cards_summary_on" android:summaryOff="@string/revanced_hide_end_screen_cards_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_filmstrip_overlay_title" android:key="revanced_hide_filmstrip_overlay" android:summaryOn="@string/revanced_hide_filmstrip_overlay_summary_on" android:summaryOff="@string/revanced_hide_filmstrip_overlay_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_info_cards_title" android:key="revanced_hide_info_cards" android:summaryOn="@string/revanced_hide_info_cards_summary_on" android:summaryOff="@string/revanced_hide_info_cards_summary_off" />
@ -709,7 +710,6 @@
<Preference android:title="Custom Shorts action buttons" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="GmsCore support" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide animated button background" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide double tap overlay filter" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide double tap to like animations" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide Shorts dimming" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Icon" android:summary="@string/revanced_icon_default" android:selectable="false"/>