mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
Sync watch progress on natural video completion and backgrounding
Naturally finished videos only saved their 100% progress locally (play() deliberately skips the sync-on-switch when videoEndedNaturally is set), so the watched state never reached other devices in the autoplay flow. Save completion through updateWatchProgress, which queues the iCloud sync. Also queue the current playback position when the app enters background, so backgrounding mid-video hands the position off to other devices instead of only syncing on explicit stop or video switch.
This commit is contained in:
@@ -282,6 +282,8 @@ struct YatteeApp: App {
|
||||
// Flush pending CloudKit changes when entering background
|
||||
if newPhase == .background {
|
||||
appEnvironment.cloudKitSync.stopForegroundPolling()
|
||||
// Queue current watch progress so the position reaches other devices
|
||||
appEnvironment.playerService.syncWatchProgress()
|
||||
Task {
|
||||
await appEnvironment.cloudKitSync.flushPendingChanges()
|
||||
}
|
||||
@@ -330,6 +332,8 @@ struct YatteeApp: App {
|
||||
// Flush pending CloudKit changes when entering background
|
||||
if newPhase == .background {
|
||||
appEnvironment.cloudKitSync.stopForegroundPolling()
|
||||
// Queue current watch progress so the position reaches other devices
|
||||
appEnvironment.playerService.syncWatchProgress()
|
||||
|
||||
#if os(iOS)
|
||||
// Persist pending SwiftData changes and run the CloudKit flush
|
||||
|
||||
Reference in New Issue
Block a user