From 170b472545d612e8fb34b43b12ad2f03efaae257 Mon Sep 17 00:00:00 2001 From: Wanja Krah Date: Tue, 17 Dec 2024 21:35:43 +0100 Subject: [PATCH] prevents the stop-sound being placed twice --- src/app/pages/modus/focus/focus.component.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app/pages/modus/focus/focus.component.ts b/src/app/pages/modus/focus/focus.component.ts index e855278..069a04a 100644 --- a/src/app/pages/modus/focus/focus.component.ts +++ b/src/app/pages/modus/focus/focus.component.ts @@ -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 } }