Skip to content

Commit d77771a

Browse files
committed
Player/handleIntent: fix enqueue if player not running
In 063dcd4 I falsely claimed that the fallthrough case is always degenerate, but it kinda somehow still worked because if you long-click on e.g. the popup button, it would call enqueue, but if nothing was running yet it would fallthrough to the very last case and start the player with the video. So let’s return to that and add a TODO for further refactoring in the future.
1 parent 01f9a3d commit d77771a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,12 @@ public void handleIntent(@NonNull final Intent intent) {
394394
return;
395395
}
396396
playQueue.append(newQueue.getStreams());
397+
return;
397398
}
398-
return;
399+
400+
// TODO: This falls through to the old logic, there was no playQueue
401+
// yet so we should start the player and add the new video
402+
break;
399403
}
400404
case EnqueueNext -> {
401405
if (playQueue != null) {
@@ -405,8 +409,12 @@ public void handleIntent(@NonNull final Intent intent) {
405409
}
406410
final PlayQueueItem newItem = newQueue.getStreams().get(0);
407411
newQueue.enqueueNext(newItem, false);
412+
return;
408413
}
409-
return;
414+
415+
// TODO: This falls through to the old logic, there was no playQueue
416+
// yet so we should start the player and add the new video
417+
break;
410418
}
411419
case TimestampChange -> {
412420
final TimestampChangeData dat = intent.getParcelableExtra(PLAYER_INTENT_DATA);

0 commit comments

Comments
 (0)