mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-28 04:40:19 +02:00
fix(YouTube/Hide comments component): Hide thanks button
setting hides the Thanks button in shorts livestreams
This commit is contained in:
parent
f8b9d3b54e
commit
cba498dd41
@ -7,7 +7,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patches.shared.litho.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.player.comments.fingerprints.ShortsLiveStreamEmojiPickerOnClickListenerFingerprint
|
||||
import app.revanced.patches.youtube.player.comments.fingerprints.ShortsLiveStreamEmojiPickerOpacityFingerprint
|
||||
import app.revanced.patches.youtube.player.comments.fingerprints.ShortsLiveStreamThanksFingerprint
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.PLAYER_CLASS_DESCRIPTOR
|
||||
@ -19,7 +18,6 @@ import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import app.revanced.util.patch.BaseBytecodePatch
|
||||
import app.revanced.util.resultOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Suppress("unused")
|
||||
@ -55,10 +53,7 @@ object CommentsComponentPatch : BaseBytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
val shortsLiveStreamEmojiPickerOnClickListenerResult =
|
||||
ShortsLiveStreamEmojiPickerOnClickListenerFingerprint.resultOrThrow()
|
||||
|
||||
shortsLiveStreamEmojiPickerOnClickListenerResult.let {
|
||||
ShortsLiveStreamEmojiPickerOnClickListenerFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val emojiPickerEndpointIndex = getWideLiteralInstructionIndex(126326492)
|
||||
val emojiPickerOnClickListenerIndex = getTargetIndex(emojiPickerEndpointIndex, Opcode.INVOKE_DIRECT)
|
||||
@ -80,25 +75,6 @@ object CommentsComponentPatch : BaseBytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for thanks button in shorts
|
||||
|
||||
ShortsLiveStreamThanksFingerprint.resolve(context, shortsLiveStreamEmojiPickerOnClickListenerResult.classDef)
|
||||
ShortsLiveStreamThanksFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val insertInstruction = getInstruction<FiveRegisterInstruction>(insertIndex)
|
||||
|
||||
addInstructions(
|
||||
insertIndex,"""
|
||||
invoke-static { v${insertInstruction.registerC}, v${insertInstruction.registerD} }, $PLAYER_CLASS_DESCRIPTOR->hideThanksButton(Landroid/view/View;I)I
|
||||
move-result v${insertInstruction.registerD}
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
/**
|
||||
|
@ -1,16 +0,0 @@
|
||||
package app.revanced.patches.youtube.player.comments.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object ShortsLiveStreamThanksFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.FINAL,
|
||||
parameters = listOf("Landroid/view/View;", "Z"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID
|
||||
)
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user