Skip to content

Commit 0546c9b

Browse files
authored
Merge pull request TeamNewPipe#9445 from Jared234/9122_remove_watched_bug
Fixed a bug that incorrectly removed videos from a playlist when using the "Remove Viewed" dialog
2 parents fd8e92c + 38c4a1e commit 0546c9b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {
404404
.firstElement()
405405
.zipWith(historyIdsMaybe, (playlist, historyStreamIds) -> {
406406
// Remove Watched, Functionality data
407-
final List<PlaylistStreamEntry> notWatchedItems = new ArrayList<>();
407+
final List<PlaylistStreamEntry> itemsToKeep = new ArrayList<>();
408408
final boolean isThumbnailPermanent = playlistManager
409409
.getIsPlaylistThumbnailPermanent(playlistId);
410410
boolean thumbnailVideoRemoved = false;
@@ -415,7 +415,7 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {
415415
playlistItem.getStreamId());
416416

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

437437
if (indexInHistory < 0 || (streamStateEntity != null
438438
&& !streamStateEntity.isFinished(duration))) {
439-
notWatchedItems.add(playlistItem);
439+
itemsToKeep.add(playlistItem);
440440
} else if (!isThumbnailPermanent && !thumbnailVideoRemoved
441441
&& playlistManager.getPlaylistThumbnail(playlistId)
442442
.equals(playlistItem.getStreamEntity().getThumbnailUrl())) {
@@ -445,17 +445,17 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {
445445
}
446446
}
447447

448-
return new Pair<>(notWatchedItems, thumbnailVideoRemoved);
448+
return new Pair<>(itemsToKeep, thumbnailVideoRemoved);
449449
});
450450

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

457457
itemListAdapter.clearStreamItemList();
458-
itemListAdapter.addItems(notWatchedItems);
458+
itemListAdapter.addItems(itemsToKeep);
459459
saveChanges();
460460

461461
if (thumbnailVideoRemoved) {

0 commit comments

Comments
 (0)