1
mirror of https://github.com/revanced/revanced-integrations synced 2024-11-22 05:02:19 +01:00

fix(YouTube - Return YouTube Dislike): Do not prefetch Shorts shelf items on app startup

This commit is contained in:
LisoUseInAIKyrios 2023-12-17 13:14:05 +04:00
parent 869b209c4b
commit 697c2aaac6
2 changed files with 12 additions and 4 deletions

View File

@ -570,7 +570,7 @@ public class ReturnYouTubeDislikePatch {
return;
}
final boolean videoIdIsShort = VideoInformation.lastVideoIdIsShort();
final boolean videoIdIsShort = VideoInformation.lastPlayerResponseIsShort();
// Shorts shelf in home and subscription feed causes player response hook to be called,
// and the 'is opening/playing' parameter will be false.
// This hook will be called again when the Short is actually opened.

View File

@ -32,6 +32,7 @@ public final class VideoInformation {
@NonNull
private static volatile String playerResponseVideoId = "";
private static volatile boolean playerResponseVideoIdIsShort;
private static volatile boolean videoIdIsShort;
/**
@ -82,6 +83,7 @@ public final class VideoInformation {
*/
public static String newPlayerResponseSignature(@NonNull String signature, boolean isShortAndOpeningOrPlaying) {
final boolean isShort = playerParametersAreShort(signature);
playerResponseVideoIdIsShort = isShort;
if (!isShort || isShortAndOpeningOrPlaying) {
if (videoIdIsShort != isShort) {
videoIdIsShort = isShort;
@ -206,11 +208,17 @@ public final class VideoInformation {
return playerResponseVideoId;
}
/**
* @return If the last player response video id was a Short.
* Includes Shorts shelf items appearing in the feed that are not opened.
* @see #lastVideoIdIsShort()
*/
public static boolean lastPlayerResponseIsShort() {
return playerResponseVideoIdIsShort;
}
/**
* @return If the last player response video id _that was opened_ was a Short.
* <p>
* Note: This value returned may not match the status of {@link #getPlayerResponseVideoId()}
* since that includes player responses for videos not opened.
*/
public static boolean lastVideoIdIsShort() {
return videoIdIsShort;