mirror of
https://github.com/yattee/yattee.git
synced 2026-11-01 01:17:20 +00:00
End the session with the watch that finished
This commit is contained in:
@@ -3196,6 +3196,19 @@ extension PlayerService: PlayerBackendDelegate {
|
|||||||
|
|
||||||
state.setPlaybackState(.ended)
|
state.setPlaybackState(.ended)
|
||||||
saveProgressAsCompleted()
|
saveProgressAsCompleted()
|
||||||
|
|
||||||
|
// The watch is over, so the session ends with it — after the completion
|
||||||
|
// save, which is the last progress this session has to mirror. A
|
||||||
|
// finished watch's session must not be left standing to absorb a future
|
||||||
|
// watch of the same video: the next load of it would otherwise reach
|
||||||
|
// `beginSessionIfNeeded`, recognise the video, keep the already-posted
|
||||||
|
// session and never mirror the second watch. Every way a finished video
|
||||||
|
// is played again on purpose starts a session of its own —
|
||||||
|
// `replayCurrentVideo()` explicitly, any other load through
|
||||||
|
// `beginSessionIfNeeded`. Ending the session does not touch a post
|
||||||
|
// already in flight.
|
||||||
|
watchHistorySyncService?.endSession()
|
||||||
|
|
||||||
delegate?.playerServiceDidFinishPlaying(self)
|
delegate?.playerServiceDidFinishPlaying(self)
|
||||||
|
|
||||||
// Repeat one: restart immediately - no countdown, independent of queue contents
|
// Repeat one: restart immediately - no countdown, independent of queue contents
|
||||||
|
|||||||
@@ -938,6 +938,12 @@ struct HistoryListView: View {
|
|||||||
// The rows may belong to another account by now; the removal
|
// The rows may belong to another account by now; the removal
|
||||||
// still happened, but this list is not the one to take it out of.
|
// still happened, but this list is not the one to take it out of.
|
||||||
guard generation == loadGeneration else { return }
|
guard generation == loadGeneration else { return }
|
||||||
|
|
||||||
|
// Accepted: a watch finishing at the same moment can post this
|
||||||
|
// same video after the server took the delete, and this
|
||||||
|
// completion — arriving later than the order the server saw —
|
||||||
|
// then takes out a row the server still has. The list is wrong
|
||||||
|
// only until the next load reads the account's history again.
|
||||||
removeRow(videoID)
|
removeRow(videoID)
|
||||||
} catch {
|
} catch {
|
||||||
appEnvironment.toastManager.showError(
|
appEnvironment.toastManager.showError(
|
||||||
|
|||||||
Reference in New Issue
Block a user