Skip to content

Commit

Permalink
Fixed the "Remove Watched" bug
Browse files Browse the repository at this point in the history
Reverted changes and fixed bug in a different way
  • Loading branch information
Jared234 authored and Stypox committed Jan 12, 2023
1 parent fd8e92c commit 38c4a1e
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {
.firstElement()
.zipWith(historyIdsMaybe, (playlist, historyStreamIds) -> {
// Remove Watched, Functionality data
final List<PlaylistStreamEntry> notWatchedItems = new ArrayList<>();
final List<PlaylistStreamEntry> itemsToKeep = new ArrayList<>();
final boolean isThumbnailPermanent = playlistManager
.getIsPlaylistThumbnailPermanent(playlistId);
boolean thumbnailVideoRemoved = false;
Expand All @@ -415,7 +415,7 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {
playlistItem.getStreamId());

if (indexInHistory < 0) {
notWatchedItems.add(playlistItem);
itemsToKeep.add(playlistItem);
} else if (!isThumbnailPermanent && !thumbnailVideoRemoved
&& playlistManager.getPlaylistThumbnail(playlistId)
.equals(playlistItem.getStreamEntity().getThumbnailUrl())) {
Expand All @@ -436,7 +436,7 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {

if (indexInHistory < 0 || (streamStateEntity != null
&& !streamStateEntity.isFinished(duration))) {
notWatchedItems.add(playlistItem);
itemsToKeep.add(playlistItem);
} else if (!isThumbnailPermanent && !thumbnailVideoRemoved
&& playlistManager.getPlaylistThumbnail(playlistId)
.equals(playlistItem.getStreamEntity().getThumbnailUrl())) {
Expand All @@ -445,17 +445,17 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {
}
}

return new Pair<>(notWatchedItems, thumbnailVideoRemoved);
return new Pair<>(itemsToKeep, thumbnailVideoRemoved);
});

disposables.add(streamsMaybe.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(flow -> {
final List<PlaylistStreamEntry> notWatchedItems = flow.first;
final List<PlaylistStreamEntry> itemsToKeep = flow.first;
final boolean thumbnailVideoRemoved = flow.second;

itemListAdapter.clearStreamItemList();
itemListAdapter.addItems(notWatchedItems);
itemListAdapter.addItems(itemsToKeep);
saveChanges();

if (thumbnailVideoRemoved) {
Expand Down

0 comments on commit 38c4a1e

Please sign in to comment.