mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-04 00:59:50 +08:00
Sync progress if needed before exit (#1896)
* fix: 定时关闭退出APP前同步视频进度 * update --------- Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user