incorporating new activity tracker changes

This commit is contained in:
Prashant Gupta 2019-03-22 15:56:20 -07:00
parent de4a8882d9
commit e69e37282a
4 changed files with 23 additions and 7 deletions

2
Makefile Normal file
View File

@ -0,0 +1,2 @@
start:
go run cmd/main.go

View File

@ -31,7 +31,7 @@ func onReady() {
//notify.SendMessage("starting the app") //notify.SendMessage("starting the app")
case <-ammStop.ClickedCh: case <-ammStop.ClickedCh:
fmt.Println("pausing the app") fmt.Println("stopping the app")
mouseMover.Quit() mouseMover.Quit()
case <-mQuit.ClickedCh: case <-mQuit.ClickedCh:

21
glide.lock generated
View File

@ -1,5 +1,5 @@
hash: 0e9d554853b2c3ed23ba323715540d961c06465a1a125959a698d6162e17f91d hash: 0e9d554853b2c3ed23ba323715540d961c06465a1a125959a698d6162e17f91d
updated: 2019-03-20T12:29:04.478748-07:00 updated: 2019-03-22T15:34:56.64781-07:00
imports: imports:
- name: github.com/BurntSushi/xgb - name: github.com/BurntSushi/xgb
version: 27f122750802c950b2c869a5b63dafcf590ced95 version: 27f122750802c950b2c869a5b63dafcf590ced95
@ -41,6 +41,8 @@ imports:
version: 193b4935d4b146c729d763c2c59a0d3e7f3cee8a version: 193b4935d4b146c729d763c2c59a0d3e7f3cee8a
subpackages: subpackages:
- clipboard - clipboard
- name: github.com/konsorten/go-windows-terminal-sequences
version: f55edac94c9bbba5d6182a4be46d86a2c9b5b50e
- name: github.com/lxn/win - name: github.com/lxn/win
version: 0040366d745006bbf7528ac96de2de375846aa79 version: 0040366d745006bbf7528ac96de2de375846aa79
- name: github.com/otiai10/gosseract - name: github.com/otiai10/gosseract
@ -48,8 +50,13 @@ imports:
- name: github.com/oxtoacart/bpool - name: github.com/oxtoacart/bpool
version: 8c4636f812cc8920c26e2002b988c878b1fd6f5e version: 8c4636f812cc8920c26e2002b988c878b1fd6f5e
- name: github.com/prashantgupta24/activity-tracker - name: github.com/prashantgupta24/activity-tracker
version: 7330e5e8a948db11beb7aef23996d37ef26977f4 version: d60ddb4a3211e471b1a3fcd9b5dec960a453c79c
subpackages: subpackages:
- internal/pkg/logging
- internal/pkg/mouse
- internal/pkg/service
- pkg/activity
- pkg/tracker
- src/activity - src/activity
- src/mouse - src/mouse
- name: github.com/robotn/gohook - name: github.com/robotn/gohook
@ -65,16 +72,22 @@ imports:
- process - process
- name: github.com/shirou/w32 - name: github.com/shirou/w32
version: bb4de0191aa41b5507caa14b0650cdbddcd9280b version: bb4de0191aa41b5507caa14b0650cdbddcd9280b
- name: github.com/sirupsen/logrus
version: dae0fa8d5b0c810a8ab733fbd5510c7cae84eca4
- name: github.com/StackExchange/wmi - name: github.com/StackExchange/wmi
version: e0a55b97c70558c92ce14085e41b35a894e93d3d version: e0a55b97c70558c92ce14085e41b35a894e93d3d
- name: github.com/vcaesar/imgo - name: github.com/vcaesar/imgo
version: 13af122cf2fa6117048933e141c0b52f19116ca6 version: 13af122cf2fa6117048933e141c0b52f19116ca6
- name: golang.org/x/crypto
version: b7391e95e576cacdcdd422573063bc057239113d
subpackages:
- ssh/terminal
- name: golang.org/x/image - name: golang.org/x/image
version: 0694c2d4d067f97ebef574d63a763ee8ab559da7 version: 3fc05d484e9f77dd51816890e05f2602e4ca4d65
subpackages: subpackages:
- bmp - bmp
- name: golang.org/x/sys - name: golang.org/x/sys
version: 6c81ef8f67ca3f42fc9cd71dfbd5f35b0c4b5771 version: f49334f85ddcf0f08d7fb6dd7363e9e6d6b777eb
subpackages: subpackages:
- unix - unix
- windows - windows

View File

@ -26,6 +26,7 @@ func (m *mouseMover) Start() {
frequency := 5 //value always in seconds frequency := 5 //value always in seconds
activityTracker := &tracker.Instance{ activityTracker := &tracker.Instance{
Frequency: frequency, Frequency: frequency,
//LogLevel: "debug", //if we want verbose logging
} }
heartbeatCh := activityTracker.Start() heartbeatCh := activityTracker.Start()
@ -42,7 +43,7 @@ func (m *mouseMover) Start() {
select { select {
case wasMouseMoveSuccess := <-commCh: case wasMouseMoveSuccess := <-commCh:
if wasMouseMoveSuccess { if wasMouseMoveSuccess {
fmt.Println("moving mouse at : \n", time.Now()) fmt.Printf("\nmoving mouse at : %v\n\n", time.Now())
movePixel *= -1 movePixel *= -1
} }
case <-time.After(timeout * time.Millisecond): case <-time.After(timeout * time.Millisecond):
@ -71,7 +72,7 @@ func moveMouse(movePixel int, commCh chan bool) {
func (m *mouseMover) Quit() { func (m *mouseMover) Quit() {
//making it idempotent //making it idempotent
if !m.isRunning { if m != nil && m.isRunning {
m.quit <- struct{}{} m.quit <- struct{}{}
} }
} }