Skip to content

Commit b9f05e7

Browse files
chore(docs): update code docs
1 parent 54de6ff commit b9f05e7

7 files changed

Lines changed: 131 additions & 72 deletions

docs/components_config_LoginScene.bs.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
m.checkbox = m.top.findNode("onOff")
1616
m.buttons = m.top.findNode("buttons")
1717
m.top.findNode("submit").text = translate(translationKeys.ButtonSubmit)
18-
m.top.findNode("quickConnect").text = translate(translationKeys.ButtonQuickConnect)
1918
end sub
2019

2120
' JRScreen hook.

docs/components_login_UserSelect.bs.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
m.top.findNode("manualLoginButton").text = translate(translationKeys.ButtonManualLogin)
1616
m.buttons = m.top.findNode("buttons")
1717

18+
' Quick Connect requires server >= 10.8.0. Remove the button entirely (rather
19+
' than hiding it) when unsupported - JRButtonGroup focus/navigation honors
20+
' isEnabled but not visible, so an invisible button at index 0 would silently
21+
' steal default focus.
22+
quickConnectButton = m.top.findNode("quickConnect")
23+
if versionChecker(m.global.server.version, "10.8.0")
24+
quickConnectButton.text = translate(translationKeys.ButtonQuickConnect)
25+
else
26+
m.buttons.removeChild(quickConnectButton)
27+
m.log.debug("Quick Connect removed - server version below 10.8.0", "version:", m.global.server.version)
28+
end if
29+
1830
m.buttons.callFunc("center")
1931

2032
' Create branding config task (reusable instance)

docs/components_quickConnect_QuickConnect.bs.html

Lines changed: 11 additions & 1 deletion
Large diffs are not rendered by default.

docs/components_quickConnect_QuickConnectDialog.bs.html

Lines changed: 77 additions & 13 deletions
Large diffs are not rendered by default.

docs/data/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/module-QuickConnectDialog.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/source_showScenes.bs.html

Lines changed: 29 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@
107107
' push all users to the user select view
108108
userSelected = CreateUserSelectGroup(publicUsersNodes)
109109
SendPerformanceBeacon("AppDialogComplete") ' Roku Performance monitoring - Dialog Closed
110-
if userSelected = "backPressed"
110+
if userSelected = "quickConnect"
111+
' Quick Connect completed the sign-in in-flow. user state (id, authToken,
112+
' and optionally registry creds based on the post-auth prompt) is already
113+
' populated on m.global.user, so skip the token/password ladder entirely.
114+
m.global.sceneManager.callFunc("clearScenes")
115+
return true
116+
else if userSelected = "backPressed"
111117
' User wants to change server - clear all scenes and restart
112118
server.Delete()
113119
unsetSetting("server")
@@ -451,11 +457,6 @@
451457
group.observeField("backPressed", port)
452458
while true
453459
msg = wait(0, port)
454-
' print "roSGNodeEvent: msg.getNode() =", msg.getNode()
455-
' print "roSGNodeEvent: msg.getData() =", msg.getData()
456-
' print "roSGNodeEvent: msg.getField() =", msg.getField()
457-
' print "roSGNodeEvent: msg.getRoSGNode() =", msg.getRoSGNode()
458-
' print "roSGNodeEvent: msg.getInfo() =", msg.getInfo()
459460
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed()
460461
group.visible = false
461462
return -1
@@ -465,10 +466,30 @@
465466
else if type(msg) = "roSGNodeEvent" and msg.getField() = "userSelected"
466467
return msg.GetData()
467468
else if type(msg) = "roSGNodeEvent" and msg.getField() = "buttonSelected"
468-
' Manual Login button pressed
469-
if msg.getData() = 0 ' button index
469+
buttonGroup = msg.getRoSGNode()
470+
buttonSelected = buttonGroup.getChild(msg.getData())
471+
if buttonSelected.id = "manualLoginButton"
470472
return ""
473+
else if buttonSelected.id = "quickConnect"
474+
json = initQuickConnect()
475+
if not isValid(json)
476+
m.global.sceneManager.callFunc("userMessage", translate(translationKeys.ButtonQuickConnect), translate(translationKeys.LabelQuickConnectNotAvailable))
477+
else
478+
' Server supports Quick Connect - show the code, then the dialog transforms
479+
' into a "Save credentials?" prompt on auth success.
480+
m.quickConnectDialog = createObject("roSGNode", "QuickConnectDialog")
481+
m.quickConnectDialog.quickConnectJson = json
482+
m.quickConnectDialog.title = translate(translationKeys.ButtonQuickConnect)
483+
m.quickConnectDialog.message = [translate(translationKeys.MessageHereIsYourQuickConnectCode, [json.Code])]
484+
m.quickConnectDialog.buttons = [translate(translationKeys.ButtonCancel)]
485+
m.quickConnectDialog.observeField("isAuthenticated", port)
486+
m.scene.dialog = m.quickConnectDialog
487+
end if
471488
end if
489+
else if type(msg) = "roSGNodeEvent" and msg.getField() = "isAuthenticated"
490+
' QuickConnectDialog only ever fires this with value=true (after the
491+
' user has answered the post-auth save-credentials prompt).
492+
return "quickConnect"
472493
end if
473494
end while
474495

@@ -510,15 +531,6 @@
510531
saveCheckBox.title = translate(translationKeys.MessageSaveCredentials)
511532
items.appendChild(saveCheckBox)
512533
checkbox.content = items
513-
quickConnect = group.findNode("quickConnect")
514-
' Quick Connect only supported for server version 10.8+ right now...
515-
if versionChecker(m.global.server.version, "10.8.0")
516-
' Add option for Quick Connect
517-
quickConnect.text = translate(translationKeys.ButtonQuickConnect)
518-
quickConnect.observeField("buttonSelected", port)
519-
else
520-
quickConnect.visible = false
521-
end if
522534

523535
items = [usernameField, passwordField]
524536
config.configItems = items
@@ -576,44 +588,6 @@
576588
stopLoadingSpinner()
577589
print "Login attempt failed..."
578590
group.findNode("alert").text = translate(translationKeys.ErrorLoginAttemptFailed)
579-
else if buttonSelected.id = "quickConnect"
580-
json = initQuickConnect()
581-
if not isValid(json)
582-
group.findNode("alert").text = translate(translationKeys.LabelQuickConnectNotAvailable)
583-
else
584-
' Server user is talking to is at least 10.8 and has quick connect enabled...
585-
m.quickConnectDialog = createObject("roSGNode", "QuickConnectDialog")
586-
m.quickConnectDialog.shouldSaveCredentials = checkbox.checkedState[0]
587-
m.quickConnectDialog.quickConnectJson = json
588-
m.quickConnectDialog.title = translate(translationKeys.ButtonQuickConnect)
589-
m.quickConnectDialog.message = [translate(translationKeys.MessageHereIsYourQuickConnectCode, [json.Code]), translate(translationKeys.LabelDialogWillCloseAutomatically)]
590-
m.quickConnectDialog.buttons = [translate(translationKeys.ButtonCancel)]
591-
m.quickConnectDialog.observeField("isAuthenticated", port)
592-
m.scene.dialog = m.quickConnectDialog
593-
end if
594-
end if
595-
596-
if msg.getField() = "isAuthenticated"
597-
authenticated = msg.getData()
598-
if authenticated = true
599-
' Quick connect authentication was successful...
600-
return "true"
601-
else
602-
dialog = createObject("roSGNode", "Dialog")
603-
dialog.id = "QuickConnectError"
604-
dialog.title = translate(translationKeys.ButtonQuickConnect)
605-
dialog.buttons = [translate(translationKeys.ButtonOk)]
606-
dialog.message = translate(translationKeys.ErrorThereWasAnErrorAuthenticatingVia)
607-
m.scene.dialog = dialog
608-
m.scene.dialog.observeField("buttonSelected", port)
609-
end if
610-
else
611-
' If there are no other button matches, check if this is a simple "OK" Dialog & Close if so
612-
dialog = msg.getRoSGNode()
613-
if dialog.id = "QuickConnectError"
614-
dialog.unobserveField("buttonSelected")
615-
dialog.close = true
616-
end if
617591
end if
618592
end if
619593
end if

0 commit comments

Comments
 (0)