fix(YouTube - Return YouTube Dislike): Prevent the first Short opened from freezing the UI (#3359)
This commit is contained in:
parent
593e261ce4
commit
e024409219
|
@ -112,7 +112,7 @@ object SpoofSignaturePatch : BytecodePatch(
|
||||||
|
|
||||||
// Hook the player parameters.
|
// Hook the player parameters.
|
||||||
PlayerResponseMethodHookPatch += PlayerResponseMethodHookPatch.Hook.ProtoBufferParameter(
|
PlayerResponseMethodHookPatch += PlayerResponseMethodHookPatch.Hook.ProtoBufferParameter(
|
||||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->spoofParameter(Ljava/lang/String;)Ljava/lang/String;"
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->spoofParameter(Ljava/lang/String;Z)Ljava/lang/String;"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Force the seekbar time and chapters to always show up.
|
// Force the seekbar time and chapters to always show up.
|
||||||
|
|
|
@ -12,6 +12,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.video.information.fingerprints.*
|
import app.revanced.patches.youtube.video.information.fingerprints.*
|
||||||
|
import app.revanced.patches.youtube.video.playerresponse.PlayerResponseMethodHookPatch
|
||||||
import app.revanced.patches.youtube.video.videoid.VideoIdPatch
|
import app.revanced.patches.youtube.video.videoid.VideoIdPatch
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
@ -26,7 +27,7 @@ import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
description = "Hooks YouTube to get information about the current playing video.",
|
description = "Hooks YouTube to get information about the current playing video.",
|
||||||
dependencies = [IntegrationsPatch::class, VideoIdPatch::class]
|
dependencies = [IntegrationsPatch::class, VideoIdPatch::class, PlayerResponseMethodHookPatch::class]
|
||||||
)
|
)
|
||||||
object VideoInformationPatch : BytecodePatch(
|
object VideoInformationPatch : BytecodePatch(
|
||||||
setOf(
|
setOf(
|
||||||
|
@ -115,6 +116,10 @@ object VideoInformationPatch : BytecodePatch(
|
||||||
VideoIdPatch.hookBackgroundPlayVideoId(videoIdMethodDescriptor)
|
VideoIdPatch.hookBackgroundPlayVideoId(videoIdMethodDescriptor)
|
||||||
VideoIdPatch.hookPlayerResponseVideoId(
|
VideoIdPatch.hookPlayerResponseVideoId(
|
||||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerResponseVideoId(Ljava/lang/String;Z)V")
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerResponseVideoId(Ljava/lang/String;Z)V")
|
||||||
|
// Call before any other video id hooks,
|
||||||
|
// so they can use VideoInformation and check if the video id is for a Short.
|
||||||
|
PlayerResponseMethodHookPatch += PlayerResponseMethodHookPatch.Hook.ProtoBufferParameterBeforeVideoId(
|
||||||
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->newPlayerResponseSignature(Ljava/lang/String;Z)Ljava/lang/String;")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the video time method
|
* Set the video time method
|
||||||
|
|
|
@ -19,7 +19,7 @@ object PlayerResponseMethodHookPatch :
|
||||||
Closeable,
|
Closeable,
|
||||||
MutableSet<PlayerResponseMethodHookPatch.Hook> by mutableSetOf() {
|
MutableSet<PlayerResponseMethodHookPatch.Hook> by mutableSetOf() {
|
||||||
private const val VIDEO_ID_PARAMETER = 1
|
private const val VIDEO_ID_PARAMETER = 1
|
||||||
private const val VIDEO_IS_OPENING_OR_PLAYING_PARAMETER = 11
|
private const val IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER = 11
|
||||||
private const val PROTO_BUFFER_PARAMETER_PARAMETER = 3
|
private const val PROTO_BUFFER_PARAMETER_PARAMETER = 3
|
||||||
|
|
||||||
private lateinit var playerResponseMethod: MutableMethod
|
private lateinit var playerResponseMethod: MutableMethod
|
||||||
|
@ -31,13 +31,13 @@ object PlayerResponseMethodHookPatch :
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
fun hookVideoId(hook: Hook) = playerResponseMethod.addInstruction(
|
fun hookVideoId(hook: Hook) = playerResponseMethod.addInstruction(
|
||||||
0, "invoke-static {p$VIDEO_ID_PARAMETER, p$VIDEO_IS_OPENING_OR_PLAYING_PARAMETER}, $hook"
|
0, "invoke-static {p$VIDEO_ID_PARAMETER, p$IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER}, $hook"
|
||||||
)
|
)
|
||||||
|
|
||||||
fun hookProtoBufferParameter(hook: Hook) = playerResponseMethod.addInstructions(
|
fun hookProtoBufferParameter(hook: Hook) = playerResponseMethod.addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
invoke-static {p$PROTO_BUFFER_PARAMETER_PARAMETER}, $hook
|
invoke-static {p$PROTO_BUFFER_PARAMETER_PARAMETER, p$IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER}, $hook
|
||||||
move-result-object p$PROTO_BUFFER_PARAMETER_PARAMETER
|
move-result-object p$PROTO_BUFFER_PARAMETER_PARAMETER
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
|
@ -104,7 +104,7 @@ object VideoIdPatch : BytecodePatch(
|
||||||
* Supports all videos and functions in all situations.
|
* Supports all videos and functions in all situations.
|
||||||
*
|
*
|
||||||
* First parameter is the video id.
|
* First parameter is the video id.
|
||||||
* Second parameter is if the video is being opened or is currently playing.
|
* Second parameter is if the video is a Short AND it is being opened or is currently playing.
|
||||||
*
|
*
|
||||||
* Hook is always called off the main thread.
|
* Hook is always called off the main thread.
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<string name="revanced_ryd_compact_layout_summary_on">Like button styled for minimum width</string>
|
<string name="revanced_ryd_compact_layout_summary_on">Like button styled for minimum width</string>
|
||||||
<string name="revanced_ryd_compact_layout_summary_off">Like button styled for best appearance</string>
|
<string name="revanced_ryd_compact_layout_summary_off">Like button styled for best appearance</string>
|
||||||
|
|
||||||
<string name="ryd_toast_on_connection_error_title">Show toast if API not available</string>
|
<string name="ryd_toast_on_connection_error_title">Show toast if API is not available</string>
|
||||||
<string name="ryd_toast_on_connection_error_summary_on">Toast shown if ReturnYouTubeDislike API is not available</string>
|
<string name="ryd_toast_on_connection_error_summary_on">Toast shown if ReturnYouTubeDislike API is not available</string>
|
||||||
<string name="ryd_toast_on_connection_error_summary_off">Toast not shown if ReturnYouTubeDislike API is not available</string>
|
<string name="ryd_toast_on_connection_error_summary_off">Toast not shown if ReturnYouTubeDislike API is not available</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue