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:
parent
869b209c4b
commit
697c2aaac6
@ -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.
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user