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 (
|
import (
|
||||||
"git.smsvc.net/pomodoro/GoTomato/internal/shared"
|
"git.smsvc.net/pomodoro/GoTomato/internal/shared"
|
||||||
// "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -47,11 +46,12 @@ func RunPomodoro() {
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetPomodoro resets the running Pomodoro timer.
|
// Stops and resets the running Pomodoro
|
||||||
func ResetPomodoro() {
|
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
|
pomodoroResetChannel <- true
|
||||||
shared.Message = shared.ResetToDefault()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func PausePomodoro() {
|
func PausePomodoro() {
|
||||||
|
|
|
@ -4,17 +4,13 @@ import (
|
||||||
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Message = ResetToDefault()
|
var Message = models.ServerMessage{
|
||||||
|
Mode: "Idle",
|
||||||
func ResetToDefault() models.ServerMessage {
|
PomodoroSettings: DefaultPomodoroConfig,
|
||||||
return models.ServerMessage{
|
Session: 0,
|
||||||
Mode: "Idle",
|
TimeLeft: DefaultPomodoroConfig.Work,
|
||||||
PomodoroSettings: DefaultPomodoroConfig,
|
Ongoing: false,
|
||||||
Session: 0,
|
Paused: false,
|
||||||
TimeLeft: DefaultPomodoroConfig.Work,
|
|
||||||
Ongoing: false,
|
|
||||||
Paused: false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var PomodoroPassword string
|
var PomodoroPassword string
|
||||||
|
|
Loading…
Reference in a new issue