Fix interval end event trigger
This commit is contained in:
parent
64ea47f42b
commit
fefe9bb6aa
3
main.go
3
main.go
@ -147,8 +147,6 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
// Handle timer update for each second
|
// Handle timer update for each second
|
||||||
m.remaining -= time.Second
|
m.remaining -= time.Second
|
||||||
if m.remaining < 0 {
|
if m.remaining < 0 {
|
||||||
m.runCommands(m.onIntervalEnd)
|
|
||||||
|
|
||||||
if m.isFocus {
|
if m.isFocus {
|
||||||
// Focus period ends, switch to break
|
// Focus period ends, switch to break
|
||||||
m.isFocus = false
|
m.isFocus = false
|
||||||
@ -162,6 +160,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
// Break ends, switch back to focus or next interval
|
// Break ends, switch back to focus or next interval
|
||||||
m.isFocus = true
|
m.isFocus = true
|
||||||
m.intervalNum++
|
m.intervalNum++
|
||||||
|
m.runCommands(m.onIntervalEnd)
|
||||||
if m.intervalNum > m.intervals {
|
if m.intervalNum > m.intervals {
|
||||||
// All intervals completed
|
// All intervals completed
|
||||||
return m, tea.Quit
|
return m, tea.Quit
|
||||||
|
Loading…
Reference in New Issue
Block a user