jf-roku/source/Main.brs

50 lines
1.1 KiB
Plaintext
Raw Normal View History

2019-01-30 04:19:27 +00:00
sub Main()
keepalive = CreateObject("roSGScreen")
keepalive.show()
app_start:
2019-03-05 04:59:31 +00:00
' First thing to do is validate the ability to use the API
LoginFlow()
' Confirm the configured server and user work
ShowLibrarySelect()
' Have a catch for exiting the library on sign-out
if get_setting("active_user") = invalid
goto app_start
end if
if getGlobal("user_change") = true
setGlobal("user_change", false)
goto app_start
end if
end sub
sub LoginFlow()
start_login:
if get_setting("server") = invalid then
print "Get server details"
ShowServerSelect()
end if
2019-01-30 04:19:27 +00:00
2019-04-20 17:54:24 +00:00
if ServerInfo() = invalid
' Maybe don't unset setting, but offer as a prompt
' Server not found, is it online? New values / Retry
print "Connection to server failed, restart flow"
SignOut()
2019-04-20 17:54:24 +00:00
unset_setting("server")
goto start_login
end if
if get_setting("active_user") = invalid then
print "Get user login"
ShowSigninSelect()
end if
2019-03-02 22:03:11 +00:00
2019-03-05 04:59:31 +00:00
m.user = AboutMe()
2019-04-20 17:40:06 +00:00
if m.user = invalid or m.user.id <> get_setting("active_user")
print "Login failed, restart flow"
2019-04-20 17:40:06 +00:00
unset_setting("active_user")
goto start_login
2019-03-05 04:59:31 +00:00
end if
2019-01-30 04:19:27 +00:00
end sub