Skip to content

Commit

Permalink
fix(YouTube - Return YouTube Dislike): Show correct value when swipin…
Browse files Browse the repository at this point in the history
…g back to prior Short and disliking
  • Loading branch information
LisoUseInAIKyrios committed Sep 11, 2024
1 parent 8332444 commit 2eb5e3a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ public static void setLastLithoShortsVideoId(@Nullable String videoId) {
if (videoIdIsSame(lastLithoShortsVideoData, videoId)) {
return;
}

if (videoId == null) {
// Litho filter did not detect the video id. App is in incognito mode,
// or the proto buffer structure was changed and the video id is no longer present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,23 @@ public static void newPlayerResponseVideoId(String videoId, boolean isShortAndOp
private final ByteArrayFilterGroupList videoIdFilterGroup = new ByteArrayFilterGroupList();

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

// After the likes icon name is some binary data and then the video id for that specific short.
videoIdFilterGroup.addAll(
// Video was previously liked before video was opened.
// on_shadowed = Video was previously like/disliked before opening.
// off_shadowed = Video was not previously liked/disliked before opening.
new ByteArrayFilterGroup(null, "ic_right_like_on_shadowed"),
// Video was not already liked.
new ByteArrayFilterGroup(null, "ic_right_like_off_shadowed")
new ByteArrayFilterGroup(null, "ic_right_like_off_shadowed"),

new ByteArrayFilterGroup(null, "ic_right_dislike_on_shadowed"),
new ByteArrayFilterGroup(null, "ic_right_dislike_off_shadowed")
);
}

Expand Down Expand Up @@ -111,6 +116,7 @@ private String findVideoId(byte[] protobufBufferArray) {
return videoId;
}
}

return null;
}
}
Expand All @@ -132,6 +138,7 @@ private static boolean byteArrayContainsString(@NonNull byte[] array, @NonNull S
return true;
}
}

return false;
}
}

0 comments on commit 2eb5e3a

Please sign in to comment.