mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
feat(youtube/hide-shorts-component): hide likes, dislikes and share buttons in shorts player
This commit is contained in:
@ -0,0 +1,11 @@
|
||||
package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelRightDislikeIcon
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object ShortsDislikeFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("Z", "Z", "L"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelRightDislikeIcon) }
|
||||
)
|
@ -0,0 +1,11 @@
|
||||
package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelRightLikeIcon
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object ShortsLikeFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("Z", "Z", "L"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelRightLikeIcon) }
|
||||
)
|
@ -0,0 +1,11 @@
|
||||
package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelDynShare
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object ShortsShareFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("Z", "Z", "L"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelDynShare) }
|
||||
)
|
@ -26,10 +26,13 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class,
|
||||
ShortsCommentButtonPatch::class,
|
||||
ShortsDislikeButtonPatch::class,
|
||||
ShortsInfoPanelPatch::class,
|
||||
ShortsLikeButtonPatch::class,
|
||||
ShortsNavigationBarPatch::class,
|
||||
ShortsPaidContentBannerPatch::class,
|
||||
ShortsRemixButtonPatch::class,
|
||||
ShortsShareButtonPatch::class,
|
||||
ShortsSubscriptionsButtonPatch::class
|
||||
]
|
||||
)
|
||||
|
@ -0,0 +1,51 @@
|
||||
package app.revanced.patches.youtube.shorts.shortscomponent.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsDislikeFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelRightDislikeIcon
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.SHORTS
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Name("hide-shorts-dislike")
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ShortsDislikeButtonPatch : BytecodePatch(
|
||||
listOf(ShortsDislikeFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
ShortsDislikeFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getWideLiteralIndex(ReelRightDislikeIcon)
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
for (index in insertIndex until implementation!!.instructions.size) {
|
||||
if (getInstruction(index).opcode != Opcode.CONST_CLASS) continue
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex + 1, """
|
||||
invoke-static {}, $SHORTS->hideShortsPlayerDislikeButton()Z
|
||||
move-result v$insertRegister
|
||||
if-nez v$insertRegister, :hide
|
||||
const v$insertRegister, $ReelRightDislikeIcon
|
||||
""", ExternalLabel("hide", getInstruction(index + 2))
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
} ?: return ShortsDislikeFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package app.revanced.patches.youtube.shorts.shortscomponent.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsLikeFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelRightLikeIcon
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.SHORTS
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Name("hide-shorts-like")
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ShortsLikeButtonPatch : BytecodePatch(
|
||||
listOf(ShortsLikeFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
ShortsLikeFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getWideLiteralIndex(ReelRightLikeIcon)
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
for (index in insertIndex until implementation!!.instructions.size) {
|
||||
if (getInstruction(index).opcode != Opcode.CONST_CLASS) continue
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex + 1, """
|
||||
invoke-static {}, $SHORTS->hideShortsPlayerLikeButton()Z
|
||||
move-result v$insertRegister
|
||||
if-nez v$insertRegister, :hide
|
||||
const v$insertRegister, $ReelRightLikeIcon
|
||||
""", ExternalLabel("hide", getInstruction(index + 2))
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
} ?: return ShortsLikeFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package app.revanced.patches.youtube.shorts.shortscomponent.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsShareFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelDynShare
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.SHORTS
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Name("hide-shorts-share")
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ShortsShareButtonPatch : BytecodePatch(
|
||||
listOf(ShortsShareFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
ShortsShareFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getWideLiteralIndex(ReelDynShare) - 2
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerShareButton(Landroid/view/View;)V"
|
||||
)
|
||||
|
||||
}
|
||||
} ?: return ShortsShareFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -60,11 +60,14 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
var MusicAppDeeplinkButtonView: Long = -1
|
||||
var QuickActionsElementContainer: Long = -1
|
||||
var ReelDynRemix: Long = -1
|
||||
var ReelDynShare: Long = -1
|
||||
var ReelPlayerBadge: Long = -1
|
||||
var ReelPlayerBadge2: Long = -1
|
||||
var ReelPlayerFooter: Long = -1
|
||||
var ReelPlayerInfoPanel: Long = -1
|
||||
var ReelPlayerPausedStateButton: Long = -1
|
||||
var ReelRightDislikeIcon: Long = -1
|
||||
var ReelRightLikeIcon: Long = -1
|
||||
var RelatedChipCloudMargin: Long = -1
|
||||
var RightComment: Long = -1
|
||||
var ScrimOverlay: Long = -1
|
||||
@ -125,11 +128,14 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
MusicAppDeeplinkButtonView = find(ID, "music_app_deeplink_button_view")
|
||||
QuickActionsElementContainer = find(ID, "quick_actions_element_container")
|
||||
ReelDynRemix = find(ID, "reel_dyn_remix")
|
||||
ReelDynShare = find(ID, "reel_dyn_share")
|
||||
ReelPlayerBadge = find(ID, "reel_player_badge")
|
||||
ReelPlayerBadge2 = find(ID, "reel_player_badge2")
|
||||
ReelPlayerFooter = find(LAYOUT, "reel_player_dyn_footer_vert_stories3")
|
||||
ReelPlayerInfoPanel = find(ID, "reel_player_info_panel")
|
||||
ReelPlayerPausedStateButton = find(ID, "reel_player_paused_state_buttons")
|
||||
ReelRightDislikeIcon = find(DRAWABLE, "reel_right_dislike_icon")
|
||||
ReelRightLikeIcon = find(DRAWABLE, "reel_right_like_icon")
|
||||
RelatedChipCloudMargin = find(LAYOUT, "related_chip_cloud_reduced_margins")
|
||||
RightComment = find(DRAWABLE, "ic_right_comment_32c")
|
||||
ScrimOverlay = find(ID, "scrim_overlay")
|
||||
|
Reference in New Issue
Block a user