Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Commit 2eb5e3a

Browse files
author
LisoUseInAIKyrios
committed
fix(YouTube - Return YouTube Dislike): Show correct value when swiping back to prior Short and disliking
1 parent 8332444 commit 2eb5e3a

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

app/src/main/java/app/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ public static void setLastLithoShortsVideoId(@Nullable String videoId) {
664664
if (videoIdIsSame(lastLithoShortsVideoData, videoId)) {
665665
return;
666666
}
667+
667668
if (videoId == null) {
668669
// Litho filter did not detect the video id. App is in incognito mode,
669670
// or the proto buffer structure was changed and the video id is no longer present.

app/src/main/java/app/revanced/integrations/youtube/patches/components/ReturnYouTubeDislikeFilterPatch.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,23 @@ public static void newPlayerResponseVideoId(String videoId, boolean isShortAndOp
6868
private final ByteArrayFilterGroupList videoIdFilterGroup = new ByteArrayFilterGroupList();
6969

7070
public ReturnYouTubeDislikeFilterPatch() {
71-
// Likes always seems to load before the dislikes, but if this
72-
// ever changes then both likes and dislikes need callbacks.
71+
// When a new Short is opened, the like buttons always seem to load before the dislike.
72+
// But if swiping back to a previous video and liking/disliking, then only that single button reloads.
73+
// So must check for both buttons.
7374
addPathCallbacks(
74-
new StringFilterGroup(null, "|shorts_like_button.eml")
75+
new StringFilterGroup(null, "|shorts_like_button.eml"),
76+
new StringFilterGroup(null, "|shorts_dislike_button.eml")
7577
);
7678

7779
// After the likes icon name is some binary data and then the video id for that specific short.
7880
videoIdFilterGroup.addAll(
79-
// Video was previously liked before video was opened.
81+
// on_shadowed = Video was previously like/disliked before opening.
82+
// off_shadowed = Video was not previously liked/disliked before opening.
8083
new ByteArrayFilterGroup(null, "ic_right_like_on_shadowed"),
81-
// Video was not already liked.
82-
new ByteArrayFilterGroup(null, "ic_right_like_off_shadowed")
84+
new ByteArrayFilterGroup(null, "ic_right_like_off_shadowed"),
85+
86+
new ByteArrayFilterGroup(null, "ic_right_dislike_on_shadowed"),
87+
new ByteArrayFilterGroup(null, "ic_right_dislike_off_shadowed")
8388
);
8489
}
8590

@@ -111,6 +116,7 @@ private String findVideoId(byte[] protobufBufferArray) {
111116
return videoId;
112117
}
113118
}
119+
114120
return null;
115121
}
116122
}
@@ -132,6 +138,7 @@ private static boolean byteArrayContainsString(@NonNull byte[] array, @NonNull S
132138
return true;
133139
}
134140
}
141+
135142
return false;
136143
}
137144
}

0 commit comments

Comments
 (0)