mod: playCount calc

This commit is contained in:
guozhigq
2024-04-27 15:32:05 +08:00
parent 6490d31d3d
commit 29bdbbfe18
4 changed files with 19 additions and 17 deletions

View File

@ -29,8 +29,8 @@ class ShutdownTimerService {
return;
}
SmartDialog.showToast("设置 $scheduledExitInMinutes 分钟后定时关闭");
_shutdownTimer = Timer(Duration(minutes: scheduledExitInMinutes),
() => _shutdownDecider());
_shutdownTimer = Timer(
Duration(minutes: scheduledExitInMinutes), () => _shutdownDecider());
}
void _showTimeUpButPauseDialog() {
@ -59,7 +59,7 @@ class ShutdownTimerService {
// Start the 10-second timer to auto close the dialog
_autoCloseDialogTimer?.cancel();
_autoCloseDialogTimer = Timer(const Duration(seconds: 10), () {
SmartDialog.dismiss();// Close the dialog
SmartDialog.dismiss(); // Close the dialog
_executeShutdown();
});
return AlertDialog(
@ -88,7 +88,8 @@ class ShutdownTimerService {
_showShutdownDialog();
return;
}
PlPlayerController plPlayerController = PlPlayerController.getInstance();
PlPlayerController plPlayerController =
PlPlayerController.getInstance(videoType: 'none');
if (!exitApp && !waitForPlayingCompleted) {
if (!plPlayerController.playerStatus.playing) {
//仅提示用户
@ -108,19 +109,22 @@ class ShutdownTimerService {
//该方法依赖耦合实现,不够优雅
isWaiting = true;
}
void handleWaitingFinished(){
if(isWaiting){
void handleWaitingFinished() {
if (isWaiting) {
_showShutdownDialog();
isWaiting = false;
}
}
void _executeShutdown() {
if (exitApp) {
//退出app
exit(0);
} else {
//暂停播放
PlPlayerController plPlayerController = PlPlayerController.getInstance();
PlPlayerController plPlayerController =
PlPlayerController.getInstance(videoType: 'none');
if (plPlayerController.playerStatus.playing) {
plPlayerController.pause();
waitForPlayingCompleted = true;