Sync progress if needed before exit (#1896)

* fix: 定时关闭退出APP前同步视频进度

* update

---------

Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
систем
2026-04-22 10:36:30 +08:00
committed by GitHub
parent d7b4ceabbf
commit 79c9849c80
2 changed files with 29 additions and 22 deletions

View File

@@ -90,7 +90,7 @@ class ShutdownTimerService {
return;
}
}
exit(0);
_syncProgressAndExit();
}
}
@@ -101,10 +101,25 @@ class ShutdownTimerService {
_durationInMinutes = 0;
SmartDialog.showToast('定时时间已到,已暂停');
case _ShutdownType.exit:
exit(0);
_syncProgressAndExit();
}
}
void _syncProgressAndExit() {
if (PlPlayerController.instance case final player?) {
final res = player.makeHeartBeat(
player.positionSeconds.value,
type: .completed,
isManual: true,
);
if (res != null) {
res.whenComplete(() => exit(0));
return;
}
}
exit(0);
}
static (int hour, int minute) _parseMinutes(int minutes) =>
(minutes ~/ 60, minutes % 60);