mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-07 10:35:49 +01:00
fix(YouTube - ReturnYouTubeDislike): Fix RYD prefetching home feed Shorts (#508)
This commit is contained in:
parent
959ae4f3be
commit
98c91af130
@ -404,11 +404,14 @@ public class ReturnYouTubeDislikePatch {
|
|||||||
/**
|
/**
|
||||||
* Injection point. Uses 'playback response' video id hook to preload RYD.
|
* Injection point. Uses 'playback response' video id hook to preload RYD.
|
||||||
*/
|
*/
|
||||||
public static void preloadVideoId(@NonNull String videoId) {
|
public static void preloadVideoId(@NonNull String videoId, boolean videoIsOpeningOrPlaying) {
|
||||||
if (!SettingsEnum.RYD_ENABLED.getBoolean()) {
|
// 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.
|
||||||
|
if (!videoIsOpeningOrPlaying || !SettingsEnum.RYD_ENABLED.getBoolean()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!SettingsEnum.RYD_SHORTS.getBoolean() && PlayerType.getCurrent().isNoneOrHidden()) {
|
if (!SettingsEnum.RYD_SHORTS.getBoolean() && PlayerType.getCurrent().isNoneHiddenOrSlidingMinimized()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (videoId.equals(lastPrefetchedVideoId)) {
|
if (videoId.equals(lastPrefetchedVideoId)) {
|
||||||
@ -471,12 +474,13 @@ public class ReturnYouTubeDislikePatch {
|
|||||||
if (videoIdIsSame(currentVideoData, videoId)) {
|
if (videoIdIsSame(currentVideoData, videoId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentVideoData = ReturnYouTubeDislike.getFetchForVideoId(videoId);
|
ReturnYouTubeDislike data = ReturnYouTubeDislike.getFetchForVideoId(videoId);
|
||||||
// Pre-emptively set the data to short status.
|
// Pre-emptively set the data to short status.
|
||||||
// Required to prevent Shorts data from being used on a minimized video in incognito mode.
|
// Required to prevent Shorts data from being used on a minimized video in incognito mode.
|
||||||
if (isNoneHiddenOrSlidingMinimized) {
|
if (isNoneHiddenOrSlidingMinimized) {
|
||||||
currentVideoData.setVideoIdIsShort(true);
|
data.setVideoIdIsShort(true);
|
||||||
}
|
}
|
||||||
|
currentVideoData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogHelper.printDebug(() -> "New video id: " + videoId + " playerType: " + currentPlayerType
|
LogHelper.printDebug(() -> "New video id: " + videoId + " playerType: " + currentPlayerType
|
||||||
|
@ -69,7 +69,7 @@ public final class VideoInformation {
|
|||||||
*
|
*
|
||||||
* @param videoId The id of the last video loaded.
|
* @param videoId The id of the last video loaded.
|
||||||
*/
|
*/
|
||||||
public static void setPlayerResponseVideoId(@NonNull String videoId) {
|
public static void setPlayerResponseVideoId(@NonNull String videoId, boolean videoIsOpeningOrPlaying) {
|
||||||
if (!playerResponseVideoId.equals(videoId)) {
|
if (!playerResponseVideoId.equals(videoId)) {
|
||||||
LogHelper.printDebug(() -> "New player response video id: " + videoId);
|
LogHelper.printDebug(() -> "New player response video id: " + videoId);
|
||||||
playerResponseVideoId = videoId;
|
playerResponseVideoId = videoId;
|
||||||
|
@ -53,9 +53,9 @@ public final class ReturnYouTubeDislikeFilterPatch extends Filter {
|
|||||||
/**
|
/**
|
||||||
* Injection point.
|
* Injection point.
|
||||||
*/
|
*/
|
||||||
public static void newPlayerResponseVideoId(String videoId) {
|
public static void newPlayerResponseVideoId(String videoId, boolean videoIsOpeningOrPlaying) {
|
||||||
try {
|
try {
|
||||||
if (!SettingsEnum.RYD_SHORTS.getBoolean()) {
|
if (!videoIsOpeningOrPlaying || !SettingsEnum.RYD_SHORTS.getBoolean()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
synchronized (lastVideoIds) {
|
synchronized (lastVideoIds) {
|
||||||
|
Loading…
Reference in New Issue
Block a user