feat: simplify timer function

- remove "mode" parameter from startTimer function
- update shared.Message.Mode for each pomodoro state
- update comments

🤖
This commit is contained in:
Sebastian Mark 2024-10-21 09:34:36 +02:00
parent 6ffd9f1e38
commit 03ab627729
2 changed files with 9 additions and 7 deletions

View file

@ -23,15 +23,18 @@ func RunPomodoro(config models.GoTomatoPomodoroConfig) {
for session := 1; session <= config.Sessions; session++ {
shared.Message.Session = session
if !startTimer(config.Work, "Work") {
shared.Message.Mode = "Work"
if !startTimer(config.Work) {
break
}
if session == config.Sessions {
if !startTimer(config.LongBreak, "LongBreak") {
shared.Message.Mode = "LongBreak"
if !startTimer(config.LongBreak) {
break
}
} else {
if !startTimer(config.ShortBreak, "ShortBreak") {
shared.Message.Mode = "ShortBreak"
if !startTimer(config.ShortBreak) {
break
}
}