kidasov
8 years agoChannel Surfer
Roregistry problem
Hello! I want to understand how to check if there is no information stored in roRegistry. I have a task.
I want to execute onUserAlreadyLogged to check if authData field exists. Any help will be highly appreciated
I thought that m.top.authData = invalid will fire obseveField but it didn't happen.
<?xml version="1.0" encoding="UTF-8"?>
<component name="ReadAuthRegistryTask" extends="Task" xsi:noNamespaceSchemaLocation="https://devtools.web.roku.com/schema/RokuSceneGraph.xsd">
<script type="text/brightscript" uri="pkg:/components/tasks/ReadAuthRegistryTask/ReadAuthRegistryTask.brs" />
<interface>
<field id="authData" type="string" />
</interface>
</component>
sub init()
m.top.functionName = "executeTask"
m.top.authData = ""
end sub
function executeTask()
registrySection = CreateObject("roRegistrySection", "Authentication")
m.top.authData = registrySection.Read("authData")
if (m.top.authData.len() = 0)
m.top.authData = invalid
end if
return m.top.authData
end function
' MainScene.brs
sub getFromLocalStorage(field, callback)
print("Get from local storage")
m.readAuthRegistryTask.observeField(field, callback)
m.readAuthRegistryTask.control = "RUN"
end sub
' callback
sub onUserAlreadyLoggedIn()
print("Callback called")
print(m.readAuthRegistryTask.authData)
end sub
' Callback onUserAlreadyLogged is not called.
getFromLocalStorage("authData", "onUserAlreadyLogged")
I want to execute onUserAlreadyLogged to check if authData field exists. Any help will be highly appreciated
