mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
fix(YouTube - Change live ring click action): Clicking on the timestamp in the comments opens the channel
This commit is contained in:
@ -40,3 +40,39 @@ internal fun indexOfPlaybackStartDescriptorInstruction(method: Method) =
|
||||
reference?.returnType == "Lcom/google/android/libraries/youtube/player/model/PlaybackStartDescriptor;" &&
|
||||
reference.parameterTypes.isEmpty()
|
||||
}
|
||||
|
||||
internal val engagementPanelCommentsClosedFingerprint = legacyFingerprint(
|
||||
name = "engagementPanelCommentsClosedFingerprint",
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_DIRECT,
|
||||
),
|
||||
customFingerprint = { method, _ ->
|
||||
method.indexOfFirstInstruction {
|
||||
opcode == Opcode.INVOKE_INTERFACE &&
|
||||
getReference<MethodReference>()?.name == "hasNext"
|
||||
} >= 0
|
||||
}
|
||||
)
|
||||
|
||||
internal val engagementPanelCommentsOpenFingerprint = legacyFingerprint(
|
||||
name = "engagementPanelCommentsOpenFingerprint",
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IF_NE,
|
||||
Opcode.RETURN_VOID,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.RETURN_VOID,
|
||||
),
|
||||
customFingerprint = { method, _ ->
|
||||
method.implementation!!.instructions.count() == 5
|
||||
}
|
||||
)
|
||||
|
@ -6,6 +6,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.youtube.utils.engagementPanelTitleParentFingerprint
|
||||
import app.revanced.patches.youtube.utils.extension.Constants.GENERAL_PATH
|
||||
import app.revanced.patches.youtube.utils.patch.PatchList.CHANGE_LIVE_RING_CLICK_ACTION
|
||||
import app.revanced.patches.youtube.utils.resourceid.sharedResourceIdPatch
|
||||
@ -37,6 +38,18 @@ val openChannelOfLiveAvatarPatch = bytecodePatch(
|
||||
|
||||
execute {
|
||||
|
||||
mapOf(
|
||||
engagementPanelCommentsClosedFingerprint to "commentsPanelClosed",
|
||||
engagementPanelCommentsOpenFingerprint to "commentsPanelOpen",
|
||||
).forEach { (fingerprint, methodName) ->
|
||||
fingerprint
|
||||
.methodOrThrow(engagementPanelTitleParentFingerprint)
|
||||
.addInstruction(
|
||||
0,
|
||||
"invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->$methodName()V"
|
||||
)
|
||||
}
|
||||
|
||||
elementsImageFingerprint.methodOrThrow().addInstruction(
|
||||
0,
|
||||
"invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->liveChannelAvatarClicked()V"
|
||||
|
Reference in New Issue
Block a user