prevents the stop-sound being placed twice

This commit is contained in:
2024-12-17 21:35:43 +01:00
parent e2232af098
commit 170b472545

View File

@@ -75,11 +75,7 @@ export class FocusPage implements OnInit, OnDestroy {
}
if (progress >= 1 || isNaN(progress)) {
progress = 1;
if (this.duration === 0) {
this.forcedEndOfTimerChime.play().catch(error => {
console.error('Error playing audio:', error);
});
clearInterval(this.interval);
this.timerStarted = null;
}
@@ -136,6 +132,9 @@ export class FocusPage implements OnInit, OnDestroy {
this.state = FocusState.STOPPED;
this.stopStatsCounter();
this.startTimer(0);
this.forcedEndOfTimerChime.play().catch(error => {
console.error('Error playing audio:', error);
});
}
private stopStatsCounter() {
@@ -149,7 +148,7 @@ export class FocusPage implements OnInit, OnDestroy {
this.state = FocusState.FOCUS;
this.stopStatsCounter();
this.focusService.startFocus();
this.startTimer(1); // 25
this.startTimer(0.3); // 25
}
reload() {
@@ -175,6 +174,6 @@ export class FocusPage implements OnInit, OnDestroy {
this.state = FocusState.LONG_BREAK;
this.stopStatsCounter();
this.focusService.startLongBreak();
this.startTimer(0.3); // 15
this.startTimer(0.2); // 15
}
}