mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +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")
|
||||
|
@ -36,18 +36,27 @@
|
||||
<string name="revanced_hide_quick_actions_share_title">@string/revanced_hide_button_share_title</string>
|
||||
|
||||
|
||||
<string name="revanced_hide_shorts_player_dislike_button_summary_off">@string/revanced_hide_button_dislike_summary_off</string>
|
||||
<string name="revanced_hide_shorts_player_dislike_button_summary_on">@string/revanced_hide_button_dislike_summary_on</string>
|
||||
<string name="revanced_hide_shorts_player_dislike_button_title">@string/revanced_hide_button_dislike_title</string>
|
||||
<string name="revanced_hide_shorts_player_info_panel_summary_off">@string/revanced_hide_info_panel_summary_off</string>
|
||||
<string name="revanced_hide_shorts_player_info_panel_summary_on">@string/revanced_hide_info_panel_summary_on</string>
|
||||
<string name="revanced_hide_shorts_player_info_panel_title">@string/revanced_hide_info_panel_title</string>
|
||||
<string name="revanced_hide_shorts_player_join_button_summary_off">@string/revanced_hide_join_button_summary_off</string>
|
||||
<string name="revanced_hide_shorts_player_join_button_summary_on">@string/revanced_hide_join_button_summary_on</string>
|
||||
<string name="revanced_hide_shorts_player_join_button_title">@string/revanced_hide_join_button_title</string>
|
||||
<string name="revanced_hide_shorts_player_paid_content_summary_off">@string/revanced_ad_remover_paid_content_summary_off</string>
|
||||
<string name="revanced_hide_shorts_player_paid_content_summary_on">@string/revanced_ad_remover_paid_content_summary_on</string>
|
||||
<string name="revanced_hide_shorts_player_paid_content_title">@string/revanced_ad_remover_paid_content_title</string>
|
||||
<string name="revanced_hide_shorts_player_like_button_summary_off">@string/revanced_hide_button_like_summary_off</string>
|
||||
<string name="revanced_hide_shorts_player_like_button_summary_on">@string/revanced_hide_button_like_summary_on</string>
|
||||
<string name="revanced_hide_shorts_player_like_button_title">@string/revanced_hide_button_like_title</string>
|
||||
<string name="revanced_hide_shorts_player_paid_content_summary_off">@string/revanced_hide_paid_content_summary_off</string>
|
||||
<string name="revanced_hide_shorts_player_paid_content_summary_on">@string/revanced_hide_paid_content_summary_on</string>
|
||||
<string name="revanced_hide_shorts_player_paid_content_title">@string/revanced_hide_paid_content_title</string>
|
||||
<string name="revanced_hide_shorts_player_remix_button_summary_off">@string/revanced_hide_button_remix_summary_off</string>
|
||||
<string name="revanced_hide_shorts_player_remix_button_summary_on">@string/revanced_hide_button_remix_summary_on</string>
|
||||
<string name="revanced_hide_shorts_player_remix_button_title">@string/revanced_hide_button_remix_title</string>
|
||||
<string name="revanced_hide_shorts_player_share_button_summary_off">@string/revanced_hide_button_share_summary_off</string>
|
||||
<string name="revanced_hide_shorts_player_share_button_summary_on">@string/revanced_hide_button_share_summary_on</string>
|
||||
<string name="revanced_hide_shorts_player_share_button_title">@string/revanced_hide_button_share_title</string>
|
||||
<string name="revanced_hide_shorts_player_thanks_button_summary_off">@string/revanced_hide_button_thanks_summary_off</string>
|
||||
<string name="revanced_hide_shorts_player_thanks_button_summary_on">@string/revanced_hide_button_thanks_summary_on</string>
|
||||
<string name="revanced_hide_shorts_player_thanks_button_title">@string/revanced_hide_button_thanks_title</string>
|
||||
|
@ -479,9 +479,6 @@
|
||||
<!-- SETTINGS: HIDE_SUGGESTED_ACTION
|
||||
<SwitchPreference android:title="@string/revanced_hide_suggested_actions_title" android:key="revanced_hide_suggested_actions" android:defaultValue="true" android:summaryOn="@string/revanced_hide_suggested_actions_summary_on" android:summaryOff="@string/revanced_hide_suggested_actions_summary_off" />SETTINGS: HIDE_SUGGESTED_ACTION -->
|
||||
|
||||
<!-- SETTINGS: HIDE_VIEW_PRODUCT
|
||||
<SwitchPreference android:title="@string/revanced_hide_view_products_title" android:key="revanced_hide_view_products" android:defaultValue="true" android:summaryOn="@string/revanced_hide_view_products_summary_on" android:summaryOff="@string/revanced_hide_view_products_summary_off" />SETTINGS: HIDE_VIEW_PRODUCT -->
|
||||
|
||||
<!-- SETTINGS: HIDE_YOUTUBE_MUSIC_BUTTON
|
||||
<SwitchPreference android:title="@string/revanced_hide_youtube_music_button_title" android:key="revanced_hide_youtube_music_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_youtube_music_button_summary_on" android:summaryOff="@string/revanced_hide_youtube_music_button_summary_off" />SETTINGS: HIDE_YOUTUBE_MUSIC_BUTTON -->
|
||||
|
||||
@ -545,10 +542,13 @@
|
||||
|
||||
<!-- SETTINGS: HIDE_SHORTS_COMPONENTS
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_comments_button_title" android:key="revanced_hide_shorts_player_comments_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_comments_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_comments_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_dislike_button_title" android:key="revanced_hide_shorts_player_dislike_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_dislike_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_dislike_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_info_panel_title" android:key="revanced_hide_shorts_player_info_panel" android:defaultValue="true" android:summaryOn="@string/revanced_hide_shorts_player_info_panel_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_info_panel_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_join_button_title" android:key="revanced_hide_shorts_player_join_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_shorts_player_join_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_join_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_like_button_title" android:key="revanced_hide_shorts_player_like_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_like_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_like_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_paid_content_title" android:key="revanced_hide_shorts_player_paid_content" android:defaultValue="true" android:summaryOn="@string/revanced_hide_shorts_player_paid_content_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_paid_content_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_remix_button_title" android:key="revanced_hide_shorts_player_remix_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_shorts_player_remix_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_remix_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_share_button_title" android:key="revanced_hide_shorts_player_share_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_share_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_share_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_subscriptions_button_title" android:key="revanced_hide_shorts_player_subscriptions_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_shorts_player_subscriptions_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_subscriptions_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_thanks_button_title" android:key="revanced_hide_shorts_player_thanks_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_shorts_player_thanks_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_thanks_button_summary_off" />
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_experimental_flag" />
|
||||
|
Reference in New Issue
Block a user