fix: ResetPomodoro()
resets to current settings not server defaults
- reset shared.Message fields to current values in `ResetPomodoro()` function - remove `ResetToDefault()`
This commit is contained in:
parent
cb6616f400
commit
5bf9753dce
2 changed files with 11 additions and 15 deletions
|
@ -2,7 +2,6 @@ package pomodoro
|
|||
|
||||
import (
|
||||
"git.smsvc.net/pomodoro/GoTomato/internal/shared"
|
||||
// "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||
"sync"
|
||||
)
|
||||
|
||||
|
@ -47,11 +46,12 @@ func RunPomodoro() {
|
|||
mu.Unlock()
|
||||
}
|
||||
|
||||
// ResetPomodoro resets the running Pomodoro timer.
|
||||
// Stops and resets the running Pomodoro
|
||||
func ResetPomodoro() {
|
||||
// Send a reset signal to stop any running timers
|
||||
shared.Message.Mode = "Idle"
|
||||
shared.Message.Session = 0
|
||||
shared.Message.TimeLeft = shared.Message.PomodoroSettings.Work
|
||||
pomodoroResetChannel <- true
|
||||
shared.Message = shared.ResetToDefault()
|
||||
}
|
||||
|
||||
func PausePomodoro() {
|
||||
|
|
|
@ -4,17 +4,13 @@ import (
|
|||
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||
)
|
||||
|
||||
var Message = ResetToDefault()
|
||||
|
||||
func ResetToDefault() models.ServerMessage {
|
||||
return models.ServerMessage{
|
||||
Mode: "Idle",
|
||||
PomodoroSettings: DefaultPomodoroConfig,
|
||||
Session: 0,
|
||||
TimeLeft: DefaultPomodoroConfig.Work,
|
||||
Ongoing: false,
|
||||
Paused: false,
|
||||
}
|
||||
var Message = models.ServerMessage{
|
||||
Mode: "Idle",
|
||||
PomodoroSettings: DefaultPomodoroConfig,
|
||||
Session: 0,
|
||||
TimeLeft: DefaultPomodoroConfig.Work,
|
||||
Ongoing: false,
|
||||
Paused: false,
|
||||
}
|
||||
|
||||
var PomodoroPassword string
|
||||
|
|
Loading…
Reference in a new issue