misc updates

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-26 11:54:53 -07:00
parent dc8f74d0e8
commit 156b046c0d
2 changed files with 18 additions and 10 deletions

25
main.go
View File

@ -217,10 +217,10 @@ func mainMouseClick(b *gui.ButtonMap) {
event.Account = b.Account
prepareAndSend(event)
// count := 0
count := 0
for {
log.Println("\tSleep() in buttonClick() gui.Data.State =", gui.Data.State)
time.Sleep(20 * time.Millisecond)
time.Sleep(200 * time.Millisecond)
if (gui.Data.State == "NEW PROTOBUF") {
if (currentMessage == nil) {
gui.SocketError()
@ -232,6 +232,13 @@ func mainMouseClick(b *gui.ButtonMap) {
log.Println("\tLOGIN WAS OK!", msg)
log.Println("\tLOGIN WAS OK! old button.Account was =", b.Account)
log.Println("\tLOGIN WAS OK! currentMessage.Account =", currentMessage.Account)
if (b.Account.Id == currentMessage.Account.Id) {
if (b.Account.Token != currentMessage.Account.Token) {
log.Println("\tLOGIN SENT NEW TOKEN")
b.Account.Token = currentMessage.Account.Token
log.Println("\tLOGIN WAS OK! old button.Account is now =", b.Account)
}
}
log.Println("\tLOGIN WAS OK!")
gui.MessageWindow("Login OK", msg)
} else if (currentMessage.Type == pb.Event_FAIL) {
@ -250,8 +257,7 @@ func mainMouseClick(b *gui.ButtonMap) {
}
return
}
/*
TODO: fix this with an actual timeout
// TODO: fix this with an actual timeout
count += 1
if (count > 10) {
log.Println("\tERROR: waited too long for a resposne")
@ -259,11 +265,15 @@ func mainMouseClick(b *gui.ButtonMap) {
gui.Data.State = "done"
return
}
*/
}
} else if (b.Action == "SHOW") {
log.Println("\tTRIGGER DISPLAY ACCOUNT")
gui.Data.State = "SEND WEBSOCKET"
event := pb.MakeGetEvent()
event.Account = b.Account
prepareAndSend(event)
count := 0
for {
log.Println("\tSleep() in buttonClick() gui.Data.State =", gui.Data.State)
@ -353,11 +363,6 @@ func watchGUI() {
count += 1
time.Sleep(200 * time.Millisecond)
if (gui.Data.State == "SEND WEBSOCKET") {
log.Println("\tTRIGGERING SEND WEBSOCKET")
event := pb.MakeGetEvent()
prepareAndSend(event)
}
if (gui.Data.State == "CREATE") {
log.Println("\tTRIGGERING CREATE")
event := pb.MakeAddVmEvent()

View File

@ -3,6 +3,7 @@
"height": 500,
"accounts": [
{
"id": 42,
"nick": "jcarr",
"username": "jcarr@wit.com",
"token": "eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJ4IjozLCJyIjoiIiwiY3NyZiI6InRBY1p2eXVJbk1YdWUxV0RSbDFIeDI5YSIsImV4cCI6MTU1OTI3MDQwMCwiaXNzIjoid2l0Iiwic3ViIjoiamNhcnJAd2l0LmNvbSJ9.bqXX_6yrUHQGYh3SEmW8ydSa9Xfqx-HIKutTN_GirwhC_VrVX1xJBcgYfjdKGegvwY7Td1vO3rs40Iz7ifcptrtdzJnDX62d_1JJPKBHUQUfnTLr2qoTgaljElFM0Q_e",
@ -12,6 +13,7 @@
"domain": "test.wit.com"
},
{
"id": 21,
"nick": "jcarr2",
"username": "jcarr@wit.com",
"email": "jcarr@wit.com",
@ -22,6 +24,7 @@
"domain": "test.wit.com"
},
{
"id": 57,
"nick": "bmath",
"username": "bmath@wit.com",
"token": "eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJ4IjoyLCJyIjoiIiwiY3NyZiI6ImJRSVFtV2JjdktUN2FtUWpEZWlMUFhXeSIsImV4cCI6MTU1OTQzMTgzNiwiaXNzIjoid2l0Iiwic3ViIjoiYm1hdGhAd2l0LmNvbSJ9.9hdVWBZwAA1Hssf6Oh9UlP_DW3TPIv30wuq8pyhQHtQLaBgAXgaSqwBbGOWrjhYixQlzfUCZ6Oym6AqVNJ3H5_lPl3wwUm7Qz3G0zmenV2BE54rtVoENbzm_cKSzMqco",