feat: refactor to use local pointer for ServerMessage

- replace `shared.ServerMessage` with local pomodoro pointer
- update conditions to use `pomodoro` instead of `shared.ServerMessage`

🤖
This commit is contained in:
Sebastian Mark 2024-10-23 13:48:16 +02:00
parent a61da7d280
commit 98013780da
3 changed files with 24 additions and 23 deletions

View file

@ -29,15 +29,16 @@ func Start() {
}
go websocket.ProcessServerMessages(conn)
pomodoro := &shared.ServerMessage
keyboard.Listen(func(key keys.Key) (stop bool, err error) {
switch key.String() {
case "space":
if !shared.ServerMessage.Ongoing {
if !pomodoro.Ongoing {
websocket.SendCmd(conn, *password, "start")
return false, nil
}
if shared.ServerMessage.Paused {
if pomodoro.Paused {
websocket.SendCmd(conn, *password, "resume")
return false, nil
} else {