Skip to content

Commit

Permalink
Fix to QuickConnect
Browse files Browse the repository at this point in the history
  • Loading branch information
jimdogx authored and cewert committed Jan 14, 2024
1 parent 5db1b48 commit 6c9b3f1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
14 changes: 11 additions & 3 deletions components/quickConnect/QuickConnect.bs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ sub monitorQuickConnect()
authenticated = checkQuickConnect(m.top.secret)

if authenticated = true
m.top.authenticated = 1
else
m.top.authenticated = -1
loggedIn = AuthenticateViaQuickConnect(m.top.secret)
if loggedIn
currentUser = AboutMe()
session.user.Login(currentUser, m.top.saveCredentials)
session.user.LoadUserPreferences()
LoadUserAbilities()
m.top.authenticated = 1
return
end if
end if

m.top.authenticated = -1
end sub
1 change: 1 addition & 0 deletions components/quickConnect/QuickConnect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<interface>
<field id="secret" type="string" />
<field id="authenticated" type="integer" value="0" />
<field id="saveCredentials" type="boolean" />
</interface>
</component>
20 changes: 6 additions & 14 deletions components/quickConnect/QuickConnectDialog.bs
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,32 @@ sub quickConnectStatus()
m.quickConnectTimer.control = "stop"
m.checkTask = CreateObject("roSGNode", "QuickConnect")
m.checkTask.secret = m.top.quickConnectJson.secret
m.checkTask.saveCredentials = m.top.saveCredentials
m.checkTask.observeField("authenticated", "OnAuthenticated")
m.checkTask.control = "run"
end sub

sub OnAuthenticated()
m.checkTask.control = "stop"
m.checkTask.unobserveField("authenticated")

' Did we get the A-OK to authenticate?
authenticated = m.checkTask.authenticated
if authenticated < 0
' Still waiting, check again in 3 seconds...
authenticated = 0
m.checkTask.observeField("authenticated", "OnAuthenticated")
m.quickConnectTimer.control = "start"
else if authenticated > 0
' We've been given the go ahead, try to authenticate via Quick Connect...
authenticated = AuthenticateViaQuickConnect(m.top.quickConnectJson.secret)
if authenticated <> invalid and authenticated = true
currentUser = AboutMe()
session.user.Login(currentUser, m.top.saveCredentials)
session.user.LoadUserPreferences()
LoadUserAbilities()
m.top.close = true
m.top.authenticated = true
else
m.top.close = true
m.top.authenticated = false
end if
' We've been logged in via Quick Connect...
m.top.close = true
m.top.authenticated = true
end if
end sub

sub quickConnectClosed()
m.quickConnectTimer.control = "stop"
if m.checkTask <> invalid
m.checkTask.control = "stop"
m.checkTask.unobserveField("authenticated")
end if
m.top.close = true
Expand Down

0 comments on commit 6c9b3f1

Please sign in to comment.