-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.go
More file actions
44 lines (40 loc) · 909 Bytes
/
Copy pathtimer.go
File metadata and controls
44 lines (40 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"github.com/ashdawson/gomob/notif"
"strconv"
"time"
)
var isTimerOnly = false
var sessionStartTime time.Time
func startTimer(reminderTime int) {
wg.Add(1)
go func() {
defer wg.Done()
settings.updateBranch()
time.Sleep(time.Duration(reminderTime) * time.Minute)
notif.Notify("Your mob time has ended")
var swap = notif.Question("Your mob time has ended. Are you ready to swap?")
if swap {
next()
} else {
var selected, _ = notif.List("Remind me again in:", []string{"5", "10", "15"})
reminderTime, err := strconv.Atoi(selected)
check(err)
startTimer(reminderTime)
}
}()
}
func join() {
wg.Add(1)
go func() {
defer wg.Done()
settings.updateBranch()
time.Sleep(1 * time.Second)
if getGitUserName() == getNextAuthor() && isLastChangeSecondsAgo() {
notif.Notify("It is your turn to start")
startSession()
return
}
join()
}()
}