mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-07 10:35:49 +01:00
fix(YouTube - Return YouTube Dislike): Do not prefetch Shorts shelf items on app startup
This commit is contained in:
parent
869b209c4b
commit
697c2aaac6
@ -570,7 +570,7 @@ public class ReturnYouTubeDislikePatch {
|
|||||||
return;
|
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,
|
// Shorts shelf in home and subscription feed causes player response hook to be called,
|
||||||
// and the 'is opening/playing' parameter will be false.
|
// and the 'is opening/playing' parameter will be false.
|
||||||
// This hook will be called again when the Short is actually opened.
|
// This hook will be called again when the Short is actually opened.
|
||||||
|
@ -32,6 +32,7 @@ public final class VideoInformation {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private static volatile String playerResponseVideoId = "";
|
private static volatile String playerResponseVideoId = "";
|
||||||
|
private static volatile boolean playerResponseVideoIdIsShort;
|
||||||
private static volatile boolean videoIdIsShort;
|
private static volatile boolean videoIdIsShort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,6 +83,7 @@ public final class VideoInformation {
|
|||||||
*/
|
*/
|
||||||
public static String newPlayerResponseSignature(@NonNull String signature, boolean isShortAndOpeningOrPlaying) {
|
public static String newPlayerResponseSignature(@NonNull String signature, boolean isShortAndOpeningOrPlaying) {
|
||||||
final boolean isShort = playerParametersAreShort(signature);
|
final boolean isShort = playerParametersAreShort(signature);
|
||||||
|
playerResponseVideoIdIsShort = isShort;
|
||||||
if (!isShort || isShortAndOpeningOrPlaying) {
|
if (!isShort || isShortAndOpeningOrPlaying) {
|
||||||
if (videoIdIsShort != isShort) {
|
if (videoIdIsShort != isShort) {
|
||||||
videoIdIsShort = isShort;
|
videoIdIsShort = isShort;
|
||||||
@ -206,11 +208,17 @@ public final class VideoInformation {
|
|||||||
return playerResponseVideoId;
|
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.
|
* @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() {
|
public static boolean lastVideoIdIsShort() {
|
||||||
return videoIdIsShort;
|
return videoIdIsShort;
|
||||||
|
Loading…
Reference in New Issue
Block a user