mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-05 09:04:34 +02:00
feat(YouTube/Player components): Hide player popup panels
setting now hides the products panel (Contributed by @OxrxL) https://github.com/inotia00/ReVanced_Extended/issues/2236
This commit is contained in:
parent
9ac5d9a055
commit
eb63d2ac3a
@ -5,8 +5,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patches.shared.captions.fingerprints.StartVideoInformerFingerprint
|
|
||||||
import app.revanced.patches.shared.captions.fingerprints.SubtitleTrackFingerprint
|
import app.revanced.patches.shared.captions.fingerprints.SubtitleTrackFingerprint
|
||||||
|
import app.revanced.patches.shared.fingerprints.StartVideoInformerFingerprint
|
||||||
import app.revanced.util.getWalkerMethod
|
import app.revanced.util.getWalkerMethod
|
||||||
import app.revanced.util.indexOfFirstInstruction
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
import app.revanced.util.resultOrThrow
|
import app.revanced.util.resultOrThrow
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.shared.captions.fingerprints
|
package app.revanced.patches.shared.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
@ -9,6 +9,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
|||||||
import app.revanced.patcher.patch.PatchException
|
import app.revanced.patcher.patch.PatchException
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
|
import app.revanced.patches.shared.fingerprints.StartVideoInformerFingerprint
|
||||||
import app.revanced.patches.shared.litho.LithoFilterPatch
|
import app.revanced.patches.shared.litho.LithoFilterPatch
|
||||||
import app.revanced.patches.youtube.player.components.fingerprints.CrowdfundingBoxFingerprint
|
import app.revanced.patches.youtube.player.components.fingerprints.CrowdfundingBoxFingerprint
|
||||||
import app.revanced.patches.youtube.player.components.fingerprints.EngagementPanelControllerFingerprint
|
import app.revanced.patches.youtube.player.components.fingerprints.EngagementPanelControllerFingerprint
|
||||||
@ -20,6 +21,9 @@ 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.LayoutCircleFingerprint
|
||||||
import app.revanced.patches.youtube.player.components.fingerprints.LayoutIconFingerprint
|
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.LayoutVideoFingerprint
|
||||||
|
import app.revanced.patches.youtube.player.components.fingerprints.LithoComponentOnClickListenerFingerprint
|
||||||
|
import app.revanced.patches.youtube.player.components.fingerprints.NoticeOnClickListenerFingerprint
|
||||||
|
import app.revanced.patches.youtube.player.components.fingerprints.OfflineActionsOnClickListenerFingerprint
|
||||||
import app.revanced.patches.youtube.player.components.fingerprints.QuickSeekOverlayFingerprint
|
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.SeekEduContainerFingerprint
|
||||||
import app.revanced.patches.youtube.player.components.fingerprints.SuggestedActionsFingerprint
|
import app.revanced.patches.youtube.player.components.fingerprints.SuggestedActionsFingerprint
|
||||||
@ -67,7 +71,7 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
|||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
SharedResourceIdPatch::class,
|
SharedResourceIdPatch::class,
|
||||||
SpeedOverlayPatch::class,
|
SpeedOverlayPatch::class,
|
||||||
SuggestedVideoEndScreenPatch::class
|
SuggestedVideoEndScreenPatch::class,
|
||||||
),
|
),
|
||||||
compatiblePackages = COMPATIBLE_PACKAGE,
|
compatiblePackages = COMPATIBLE_PACKAGE,
|
||||||
fingerprints = setOf(
|
fingerprints = setOf(
|
||||||
@ -78,8 +82,12 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
|||||||
LayoutCircleFingerprint,
|
LayoutCircleFingerprint,
|
||||||
LayoutIconFingerprint,
|
LayoutIconFingerprint,
|
||||||
LayoutVideoFingerprint,
|
LayoutVideoFingerprint,
|
||||||
|
LithoComponentOnClickListenerFingerprint,
|
||||||
|
NoticeOnClickListenerFingerprint,
|
||||||
|
OfflineActionsOnClickListenerFingerprint,
|
||||||
QuickSeekOverlayFingerprint,
|
QuickSeekOverlayFingerprint,
|
||||||
SeekEduContainerFingerprint,
|
SeekEduContainerFingerprint,
|
||||||
|
StartVideoInformerFingerprint,
|
||||||
SuggestedActionsFingerprint,
|
SuggestedActionsFingerprint,
|
||||||
TouchAreaOnClickListenerFingerprint,
|
TouchAreaOnClickListenerFingerprint,
|
||||||
WatermarkParentFingerprint,
|
WatermarkParentFingerprint,
|
||||||
@ -114,15 +122,45 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
|||||||
|
|
||||||
// region patch for disable auto player popup panels
|
// region patch for disable auto player popup panels
|
||||||
|
|
||||||
|
fun MutableMethod.hookInitVideoPanel(initVideoPanel: Int) =
|
||||||
|
addInstructions(
|
||||||
|
0, """
|
||||||
|
const/4 v0, $initVideoPanel
|
||||||
|
invoke-static {v0}, $PLAYER_CLASS_DESCRIPTOR->setInitVideoPanel(Z)V
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
arrayOf(
|
||||||
|
LithoComponentOnClickListenerFingerprint,
|
||||||
|
NoticeOnClickListenerFingerprint,
|
||||||
|
OfflineActionsOnClickListenerFingerprint,
|
||||||
|
StartVideoInformerFingerprint,
|
||||||
|
).forEach { fingerprint ->
|
||||||
|
fingerprint.resultOrThrow().mutableMethod.apply {
|
||||||
|
if (fingerprint == StartVideoInformerFingerprint) {
|
||||||
|
hookInitVideoPanel(1)
|
||||||
|
} else {
|
||||||
|
val syntheticIndex = getTargetIndexOrThrow(Opcode.NEW_INSTANCE)
|
||||||
|
val syntheticReference =
|
||||||
|
getInstruction<ReferenceInstruction>(syntheticIndex).reference.toString()
|
||||||
|
val syntheticClass =
|
||||||
|
context.findClass(syntheticReference)!!.mutableClass
|
||||||
|
|
||||||
|
syntheticClass.methods.find { method -> method.name == "onClick" }
|
||||||
|
?.hookInitVideoPanel(0)
|
||||||
|
?: throw PatchException("Could not find onClick method in $syntheticReference")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EngagementPanelControllerFingerprint.resultOrThrow().let {
|
EngagementPanelControllerFingerprint.resultOrThrow().let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
addInstructionsWithLabels(
|
addInstructionsWithLabels(
|
||||||
0, """
|
0, """
|
||||||
invoke-static {}, $PLAYER_CLASS_DESCRIPTOR->disableAutoPlayerPopupPanels()Z
|
move/from16 v0, p4
|
||||||
|
invoke-static {v0}, $PLAYER_CLASS_DESCRIPTOR->disableAutoPlayerPopupPanels(Z)Z
|
||||||
move-result v0
|
move-result v0
|
||||||
if-eqz v0, :shown
|
if-eqz v0, :shown
|
||||||
# The type of the fourth parameter is boolean.
|
|
||||||
if-eqz p4, :shown
|
|
||||||
const/4 v0, 0x0
|
const/4 v0, 0x0
|
||||||
return-object v0
|
return-object v0
|
||||||
""", ExternalLabel("shown", getInstruction(0))
|
""", ExternalLabel("shown", getInstruction(0))
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.youtube.player.components.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ComponentLongClickListener
|
||||||
|
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
@Suppress("SpellCheckingInspection")
|
||||||
|
internal object LithoComponentOnClickListenerFingerprint : LiteralValueFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PRIVATE or AccessFlags.STATIC,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
literalSupplier = { ComponentLongClickListener }
|
||||||
|
)
|
@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.youtube.player.components.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.Notice
|
||||||
|
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
internal object NoticeOnClickListenerFingerprint : LiteralValueFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
literalSupplier = { Notice }
|
||||||
|
)
|
@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.player.components.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.OfflineActionsVideoDeletedUndoSnackbarText
|
||||||
|
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
internal object OfflineActionsOnClickListenerFingerprint : LiteralValueFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("Ljava/lang/String;"),
|
||||||
|
literalSupplier = { OfflineActionsVideoDeletedUndoSnackbarText }
|
||||||
|
)
|
@ -38,6 +38,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
var ChannelListSubMenu = -1L
|
var ChannelListSubMenu = -1L
|
||||||
var CompactLink = -1L
|
var CompactLink = -1L
|
||||||
var CompactListItem = -1L
|
var CompactListItem = -1L
|
||||||
|
var ComponentLongClickListener = -1L
|
||||||
var ControlsLayoutStub = -1L
|
var ControlsLayoutStub = -1L
|
||||||
var DarkBackground = -1L
|
var DarkBackground = -1L
|
||||||
var DarkSplashAnimation = -1L
|
var DarkSplashAnimation = -1L
|
||||||
@ -71,7 +72,9 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
var ModernMiniPlayerForwardButton = -1L
|
var ModernMiniPlayerForwardButton = -1L
|
||||||
var ModernMiniPlayerRewindButton = -1L
|
var ModernMiniPlayerRewindButton = -1L
|
||||||
var MusicAppDeeplinkButtonView = -1L
|
var MusicAppDeeplinkButtonView = -1L
|
||||||
|
var Notice = -1L
|
||||||
var NotificationBigPictureIconWidth = -1L
|
var NotificationBigPictureIconWidth = -1L
|
||||||
|
var OfflineActionsVideoDeletedUndoSnackbarText = -1L
|
||||||
var PlayerCollapseButton = -1L
|
var PlayerCollapseButton = -1L
|
||||||
var PlayerVideoTitleView = -1L
|
var PlayerVideoTitleView = -1L
|
||||||
var PosterArtWidthDefault = -1L
|
var PosterArtWidthDefault = -1L
|
||||||
@ -138,6 +141,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
ChannelListSubMenu = getId(LAYOUT, "channel_list_sub_menu")
|
ChannelListSubMenu = getId(LAYOUT, "channel_list_sub_menu")
|
||||||
CompactLink = getId(LAYOUT, "compact_link")
|
CompactLink = getId(LAYOUT, "compact_link")
|
||||||
CompactListItem = getId(LAYOUT, "compact_list_item")
|
CompactListItem = getId(LAYOUT, "compact_list_item")
|
||||||
|
ComponentLongClickListener = getId(ID, "component_long_click_listener")
|
||||||
ControlsLayoutStub = getId(ID, "controls_layout_stub")
|
ControlsLayoutStub = getId(ID, "controls_layout_stub")
|
||||||
DarkBackground = getId(ID, "dark_background")
|
DarkBackground = getId(ID, "dark_background")
|
||||||
DarkSplashAnimation = getId(ID, "dark_splash_animation")
|
DarkSplashAnimation = getId(ID, "dark_splash_animation")
|
||||||
@ -173,7 +177,9 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
ModernMiniPlayerForwardButton = getId(ID, "modern_miniplayer_forward_button")
|
ModernMiniPlayerForwardButton = getId(ID, "modern_miniplayer_forward_button")
|
||||||
ModernMiniPlayerRewindButton = getId(ID, "modern_miniplayer_rewind_button")
|
ModernMiniPlayerRewindButton = getId(ID, "modern_miniplayer_rewind_button")
|
||||||
MusicAppDeeplinkButtonView = getId(ID, "music_app_deeplink_button_view")
|
MusicAppDeeplinkButtonView = getId(ID, "music_app_deeplink_button_view")
|
||||||
|
Notice = getId(ID, "notice")
|
||||||
NotificationBigPictureIconWidth = getId(DIMEN, "notification_big_picture_icon_width")
|
NotificationBigPictureIconWidth = getId(DIMEN, "notification_big_picture_icon_width")
|
||||||
|
OfflineActionsVideoDeletedUndoSnackbarText = getId(STRING, "offline_actions_video_deleted_undo_snackbar_text")
|
||||||
PlayerCollapseButton = getId(ID, "player_collapse_button")
|
PlayerCollapseButton = getId(ID, "player_collapse_button")
|
||||||
PlayerVideoTitleView = getId(ID, "player_video_title_view")
|
PlayerVideoTitleView = getId(ID, "player_video_title_view")
|
||||||
PosterArtWidthDefault = getId(DIMEN, "poster_art_width_default")
|
PosterArtWidthDefault = getId(DIMEN, "poster_art_width_default")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user