80 lines
2.3 KiB
Plaintext
80 lines
2.3 KiB
Plaintext
import "pkg:/source/api/baserequest.bs"
|
|
import "pkg:/source/utils/config.bs"
|
|
import "pkg:/source/utils/misc.bs"
|
|
import "pkg:/source/utils/deviceCapabilities.bs"
|
|
|
|
sub init()
|
|
m.isFirstRun = true
|
|
m.top.overhangTitle = "Home"
|
|
m.top.optionsAvailable = true
|
|
m.postTask = createObject("roSGNode", "PostTask")
|
|
|
|
m.homeRows = m.top.findNode("homeRows")
|
|
|
|
m.fadeInFocusBitmap = m.top.findNode("fadeInFocusBitmap")
|
|
|
|
if m.global.session.user.settings["ui.home.splashBackground"] = true
|
|
m.backdrop = m.top.findNode("backdrop")
|
|
m.backdrop.uri = buildURL("/Branding/Splashscreen?format=jpg&foregroundLayer=0.15&fillWidth=1280&width=1280&fillHeight=720&height=720&tag=splash")
|
|
end if
|
|
end sub
|
|
|
|
sub refresh()
|
|
m.homeRows.focusBitmapBlendColor = "0xFFFFFFFF"
|
|
m.homeRows.callFunc("updateHomeRows")
|
|
end sub
|
|
|
|
sub loadLibraries()
|
|
m.homeRows.focusBitmapBlendColor = "0xFFFFFF00"
|
|
m.homeRows.callFunc("loadLibraries")
|
|
m.fadeInFocusBitmap.control = "start"
|
|
end sub
|
|
|
|
' JFScreen hook called when the screen is displayed by the screen manager
|
|
sub OnScreenShown()
|
|
scene = m.top.getScene()
|
|
overhang = scene.findNode("overhang")
|
|
if isValid(overhang)
|
|
overhang.isLogoVisible = true
|
|
overhang.currentUser = m.global.session.user.name
|
|
overhang.title = tr("Home")
|
|
end if
|
|
|
|
if isValid(m.top.lastFocus)
|
|
m.top.lastFocus.setFocus(true)
|
|
else
|
|
m.top.setFocus(true)
|
|
end if
|
|
|
|
if not m.isFirstRun
|
|
refresh()
|
|
end if
|
|
|
|
' post the device profile the first time this screen is loaded
|
|
if m.isFirstRun
|
|
m.isFirstRun = false
|
|
m.postTask.arrayData = getDeviceCapabilities()
|
|
m.postTask.apiUrl = "/Sessions/Capabilities/Full"
|
|
m.postTask.control = "RUN"
|
|
m.postTask.observeField("responseCode", "postFinished")
|
|
end if
|
|
end sub
|
|
|
|
' JFScreen hook called when the screen is hidden by the screen manager
|
|
sub OnScreenHidden()
|
|
scene = m.top.getScene()
|
|
overhang = scene.findNode("overhang")
|
|
if isValid(overhang)
|
|
overhang.isLogoVisible = false
|
|
overhang.currentUser = ""
|
|
overhang.title = ""
|
|
end if
|
|
end sub
|
|
|
|
' Triggered by m.postTask after completing a post.
|
|
' Empty the task data when finished.
|
|
sub postFinished()
|
|
m.postTask.unobserveField("responseCode")
|
|
m.postTask.callFunc("empty")
|
|
end sub
|