break: rename ServerMessage.PomodoroSettings
-> .Settings
This commit is contained in:
parent
06633ff438
commit
61b2f71bf3
4 changed files with 16 additions and 16 deletions
|
@ -29,7 +29,7 @@ func RunPomodoro() {
|
|||
shared.Message.Paused = false
|
||||
mu.Unlock()
|
||||
|
||||
pomodoroConfig := shared.Message.PomodoroSettings
|
||||
pomodoroConfig := shared.Message.Settings
|
||||
|
||||
for session := 1; session <= pomodoroConfig.Sessions; session++ {
|
||||
timer = timer.Init()
|
||||
|
@ -66,7 +66,7 @@ func RunPomodoro() {
|
|||
|
||||
shared.Message.Mode = "Idle"
|
||||
shared.Message.Session = 0
|
||||
shared.Message.TimeLeft = shared.Message.PomodoroSettings.Work
|
||||
shared.Message.TimeLeft = shared.Message.Settings.Work
|
||||
}
|
||||
|
||||
func ResetPomodoro() {
|
||||
|
|
|
@ -5,12 +5,12 @@ import (
|
|||
)
|
||||
|
||||
var Message = models.ServerMessage{
|
||||
Mode: "Idle",
|
||||
PomodoroSettings: DefaultPomodoroConfig,
|
||||
Session: 0,
|
||||
TimeLeft: DefaultPomodoroConfig.Work,
|
||||
Ongoing: false,
|
||||
Paused: false,
|
||||
Mode: "Idle",
|
||||
Settings: DefaultPomodoroConfig,
|
||||
Session: 0,
|
||||
TimeLeft: DefaultPomodoroConfig.Work,
|
||||
Ongoing: false,
|
||||
Paused: false,
|
||||
}
|
||||
|
||||
var PomodoroPassword string
|
||||
|
|
|
@ -50,7 +50,7 @@ func handleClientCommands(ws *websocket.Conn) {
|
|||
case "updateSettings":
|
||||
if !pomodoro.IsPomodoroOngoing() {
|
||||
if clientCommand.PomodoroSettings != (models.GoTomatoPomodoroConfig{}) {
|
||||
shared.Message.PomodoroSettings = clientCommand.PomodoroSettings
|
||||
shared.Message.Settings = clientCommand.PomodoroSettings
|
||||
shared.Message.TimeLeft = clientCommand.PomodoroSettings.Work
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ package models
|
|||
|
||||
// ServerMessage represents the data sent to the client via WebSocket.
|
||||
type ServerMessage struct {
|
||||
Mode string `json:"mode"` // "Idle", "Work", "ShortBreak", "LongBreak" or "End"
|
||||
PomodoroSettings GoTomatoPomodoroConfig `json:"settings"` // The currrent pomodoro settings
|
||||
Session int `json:"session"` // Current session number
|
||||
TimeLeft int `json:"time_left"` // Remaining time in seconds
|
||||
Ongoing bool `json:"ongoing"` // Ongoing pomodoro
|
||||
Paused bool `json:"paused"` // Is timer paused
|
||||
GoTomatoVersion string `json:"version"` // Version of the server
|
||||
Mode string `json:"mode"` // "Idle", "Work", "ShortBreak", "LongBreak" or "End"
|
||||
Settings GoTomatoPomodoroConfig `json:"settings"` // The currrent pomodoro settings
|
||||
Session int `json:"session"` // Current session number
|
||||
TimeLeft int `json:"time_left"` // Remaining time in seconds
|
||||
Ongoing bool `json:"ongoing"` // Ongoing pomodoro
|
||||
Paused bool `json:"paused"` // Is timer paused
|
||||
GoTomatoVersion string `json:"version"` // Version of the server
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue