mirror of
https://github.com/jellyfin/jellyfin-roku.git
synced 2024-11-24 06:39:47 +00:00
Add sign out, update sign in a bit
This commit is contained in:
parent
fae99fa9f5
commit
b433304856
@ -60,7 +60,12 @@
|
||||
dialog.title = "Enter the " + configField.label
|
||||
dialog.buttons = ["OK", "Cancel"]
|
||||
|
||||
if configField.value <> "" then
|
||||
if configField.type = "password"
|
||||
' TODO - verify the child chain will be the same always
|
||||
dialog.keyboard.getChild(1).secureMode = true
|
||||
end if
|
||||
|
||||
if configField.value <> ""
|
||||
dialog.text = configField.value
|
||||
end if
|
||||
|
||||
|
@ -23,36 +23,3 @@ function onKeyEvent(key as String, press as Boolean) as Boolean
|
||||
end if
|
||||
return false
|
||||
end function
|
||||
|
||||
function onDialogButton()
|
||||
d = m.top.dialog
|
||||
button_text = d.buttons[d.buttonSelected]
|
||||
|
||||
if button_text = "OK"
|
||||
m.focused_item.text = d.text
|
||||
dismiss_dialog()
|
||||
return true
|
||||
else if button_text = "Cancel"
|
||||
dismiss_dialog()
|
||||
return false
|
||||
end if
|
||||
end function
|
||||
|
||||
|
||||
sub show_dialog(title as String)
|
||||
dialog = createObject("roSGNode", "KeyboardDialog")
|
||||
dialog.title = "Enter the " + m.focused_item.id
|
||||
dialog.buttons = ["OK", "Cancel"]
|
||||
|
||||
if m.focused_item.text <> "" then
|
||||
dialog.text = m.focused_item.text
|
||||
end if
|
||||
|
||||
m.top.dialog = dialog
|
||||
|
||||
dialog.observeField("buttonSelected", "onDialogButton")
|
||||
end sub
|
||||
|
||||
sub dismiss_dialog()
|
||||
m.top.dialog.close = true
|
||||
end sub
|
||||
|
@ -96,6 +96,14 @@
|
||||
search.setFocus(true)
|
||||
search.findNode("search-input").setFocus(true)
|
||||
search.findNode("search-input").active = true
|
||||
return true
|
||||
else if key = "options"
|
||||
options = m.top.getScene().findNode("options")
|
||||
list = options.findNode("panelList")
|
||||
|
||||
options.visible = true
|
||||
list.setFocus(true)
|
||||
|
||||
return true
|
||||
end if
|
||||
|
||||
|
@ -5,5 +5,7 @@
|
||||
<Overhang id="overhang" title="My Media" />
|
||||
<Rectangle id="footerBackdrop" height="200" />
|
||||
<SearchBox id="search" />
|
||||
|
||||
<OptionsSlider id="options" />
|
||||
</children>
|
||||
</component>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<field id="config_key" type="string" />
|
||||
<field id="value_index" type="integer" />
|
||||
<field id="value" type="string" onChange="update_title" />
|
||||
<function name="cycle" />
|
||||
<function name="press" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/config.brs" />
|
||||
<script type="text/brightscript">
|
||||
@ -25,7 +25,7 @@
|
||||
m.top.title = m.top.base_title + ": " + m.top.value
|
||||
end sub
|
||||
|
||||
sub cycle()
|
||||
sub press()
|
||||
max_opt = m.top.choices.count()
|
||||
i = m.top.value_index + 1
|
||||
while i >= max_opt
|
||||
|
@ -9,6 +9,7 @@
|
||||
</ListPanel>
|
||||
</children>
|
||||
<interface>
|
||||
<field id="buttons" type="nodearray" onChange="setFields" />
|
||||
<field id="options" type="nodearray" onChange="setFields" />
|
||||
<field id="escape" type="boolean" alwaysNotify="true" />
|
||||
</interface>
|
||||
@ -38,10 +39,12 @@
|
||||
|
||||
sub setFields()
|
||||
options = m.top.options
|
||||
buttons = m.top.buttons
|
||||
row = m.top.findNode("fieldList")
|
||||
|
||||
row.clear()
|
||||
row.appendChildren(options)
|
||||
row.appendChildren(buttons)
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
@ -54,7 +57,7 @@
|
||||
else if key = "OK"
|
||||
list = m.top.findNode("panelList")
|
||||
data = list.content.getChild(list.itemFocused)
|
||||
data.callFunc("cycle")
|
||||
data.callFunc("press")
|
||||
return true
|
||||
end if
|
||||
|
||||
|
@ -23,4 +23,8 @@ sub Main()
|
||||
end if
|
||||
|
||||
ShowLibrarySelect()
|
||||
|
||||
if get_setting("active_user") = invalid
|
||||
goto start_login
|
||||
end if
|
||||
end sub
|
||||
|
@ -97,12 +97,31 @@ sub ShowLibrarySelect()
|
||||
search.observeField("escape", port)
|
||||
search.observeField("search_value", port)
|
||||
|
||||
sidepanel = scene.findNode("options")
|
||||
new_options = []
|
||||
options_buttons = [
|
||||
{"title": "Sign out", "id": "sign_out"}
|
||||
]
|
||||
for each opt in options_buttons
|
||||
o = CreateObject("roSGNode", "OptionsButton")
|
||||
o.title = opt.title
|
||||
o.id = opt.id
|
||||
new_options.append([o])
|
||||
o.observeField("escape", port)
|
||||
end for
|
||||
|
||||
sidepanel.options = new_options
|
||||
sidepanel.observeField("escape", port)
|
||||
|
||||
while(true)
|
||||
msg = wait(0, port)
|
||||
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
|
||||
return
|
||||
else if nodeEventQ(msg, "escape") and msg.getNode() = "search"
|
||||
library.setFocus(true)
|
||||
else if nodeEventQ(msg, "escape") and msg.getNode() = "sign_out"
|
||||
SignOut()
|
||||
return
|
||||
else if nodeEventQ(msg, "search_value")
|
||||
query = msg.getRoSGNode().search_value
|
||||
if query <> invalid or query <> ""
|
||||
@ -113,8 +132,14 @@ sub ShowLibrarySelect()
|
||||
target = getMsgRowTarget(msg)
|
||||
if target.libraryType = "movies"
|
||||
ShowMovieOptions(target.data)
|
||||
if get_setting("active_user") = invalid
|
||||
return
|
||||
end if
|
||||
else if target.libraryType = "tvshows"
|
||||
ShowTVShowOptions(target.data)
|
||||
if get_setting("active_user") = invalid
|
||||
return
|
||||
end if
|
||||
else
|
||||
scene.dialog = make_dialog("This library type is not yet implemented")
|
||||
scene.dialog.observeField("buttonSelected", port)
|
||||
@ -191,8 +216,18 @@ sub ShowMovieOptions(library)
|
||||
o.value = get_user_setting(opt.key, opt.default)
|
||||
new_options.append([o])
|
||||
end for
|
||||
sidepanel.options = new_options
|
||||
options_buttons = [
|
||||
{"title": "Sign out", "id": "sign_out"}
|
||||
]
|
||||
for each opt in options_buttons
|
||||
o = CreateObject("roSGNode", "OptionsButton")
|
||||
o.title = opt.title
|
||||
o.id = opt.id
|
||||
new_options.append([o])
|
||||
o.observeField("escape", port)
|
||||
end for
|
||||
|
||||
sidepanel.options = new_options
|
||||
sidepanel.observeField("escape", port)
|
||||
|
||||
while true
|
||||
@ -203,6 +238,9 @@ sub ShowMovieOptions(library)
|
||||
options.setFocus(true)
|
||||
else if nodeEventQ(msg, "escape") and msg.getNode() = "options"
|
||||
options.setFocus(true)
|
||||
else if nodeEventQ(msg, "escape") and msg.getNode() = "sign_out"
|
||||
SignOut()
|
||||
return
|
||||
else if nodeEventQ(msg, "pageSelected") and pager.pageSelected <> invalid
|
||||
pager.pageSelected = invalid
|
||||
page_num = int(val(msg.getData().id))
|
||||
@ -216,6 +254,9 @@ sub ShowMovieOptions(library)
|
||||
else if nodeEventQ(msg, "itemSelected")
|
||||
target = getMsgRowTarget(msg)
|
||||
ShowMovieDetails(target.movieID)
|
||||
if get_setting("active_user") = invalid
|
||||
return
|
||||
end if
|
||||
else
|
||||
print msg
|
||||
print msg.getField()
|
||||
|
@ -24,3 +24,7 @@ function AboutMe()
|
||||
resp = APIRequest(url)
|
||||
return getJson(resp)
|
||||
end function
|
||||
|
||||
function SignOut()
|
||||
unset_setting("active_user")
|
||||
end function
|
||||
|
Loading…
Reference in New Issue
Block a user