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

This commit is contained in:
inotia00 2024-06-27 23:38:20 +09:00
parent 7c9261f3ce
commit 582efab299
4 changed files with 47 additions and 21 deletions

View File

@ -1,21 +0,0 @@
package app.revanced.patches.music.layout.doubletapbackground
import app.revanced.patcher.data.ResourceContext
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.shared.overlaybackground.OverlayBackgroundUtils.removeOverlayBackground
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.",
compatiblePackages = COMPATIBLE_PACKAGE,
use = false
) {
override fun execute(context: ResourceContext) {
context.removeOverlayBackground(
arrayOf("quick_seek_overlay.xml"),
arrayOf("tap_bloom_view", "dark_background")
)
}
}

View File

@ -29,6 +29,7 @@ import app.revanced.patches.music.player.components.fingerprints.OldEngagementPa
import app.revanced.patches.music.player.components.fingerprints.OldPlayerBackgroundFingerprint
import app.revanced.patches.music.player.components.fingerprints.OldPlayerLayoutFingerprint
import app.revanced.patches.music.player.components.fingerprints.PlayerPatchConstructorFingerprint
import app.revanced.patches.music.player.components.fingerprints.QuickSeekOverlayFingerprint
import app.revanced.patches.music.player.components.fingerprints.RemixGenericButtonFingerprint
import app.revanced.patches.music.player.components.fingerprints.RepeatTrackFingerprint
import app.revanced.patches.music.player.components.fingerprints.ShuffleClassReferenceFingerprint
@ -42,13 +43,16 @@ import app.revanced.patches.music.utils.integrations.Constants.PLAYER_CLASS_DESC
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.AudioVideoSwitchToggle
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ColorGrey
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.DarkBackground
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MiniPlayerPlayPauseReplayButton
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TapBloomView
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TopEnd
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TopStart
import app.revanced.patches.music.utils.settings.CategoryType
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.music.utils.videotype.VideoTypeHookPatch
import app.revanced.patches.shared.litho.LithoFilterPatch
import app.revanced.util.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.util.getReference
import app.revanced.util.getStringInstructionIndex
import app.revanced.util.getTargetIndexOrThrow
@ -57,6 +61,7 @@ import app.revanced.util.getTargetIndexWithFieldReferenceTypeOrThrow
import app.revanced.util.getWalkerMethod
import app.revanced.util.getWideLiteralInstructionIndex
import app.revanced.util.literalInstructionBooleanHook
import app.revanced.util.literalInstructionViewHook
import app.revanced.util.patch.BaseBytecodePatch
import app.revanced.util.resultOrThrow
import app.revanced.util.transformFields
@ -106,6 +111,7 @@ object PlayerComponentsPatch : BaseBytecodePatch(
OldPlayerLayoutFingerprint,
PendingIntentReceiverFingerprint,
PlayerPatchConstructorFingerprint,
QuickSeekOverlayFingerprint,
RemixGenericButtonFingerprint,
RepeatTrackFingerprint,
ShuffleClassReferenceFingerprint,
@ -593,6 +599,30 @@ object PlayerComponentsPatch : BaseBytecodePatch(
"false"
)
// 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
)
}
SettingsPatch.addSwitchPreference(
CategoryType.PLAYER,
"revanced_hide_double_tap_overlay_filter",
"false"
)
// endregion
// region patch for hide fullscreen share button
RemixGenericButtonFingerprint.resultOrThrow().let {

View File

@ -0,0 +1,15 @@
package app.revanced.patches.music.player.components.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.DarkBackground
import app.revanced.patches.music.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

@ -239,6 +239,8 @@ This does not bypass the age restriction. It just accepts it automatically."</st
<string name="revanced_hide_comment_channel_guidelines_summary">Hides the channel guidelines at the top of the comments section.</string>
<string name="revanced_hide_comment_timestamp_and_emoji_buttons_title">Hide timestamp and emoji buttons</string>
<string name="revanced_hide_comment_timestamp_and_emoji_buttons_summary">Hides the timestamp and emoji buttons when typing comments.</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">Hides dark overlay that appears when double-tapping to seek.</string>
<string name="revanced_hide_fullscreen_share_button_title">Hide fullscreen Share button</string>
<string name="revanced_hide_fullscreen_share_button_summary">Hides the Share button in the fullscreen player.</string>
<string name="revanced_remember_repeat_state_title">Remember repeat state</string>