2023-10-03 16:11:25 +00:00
|
|
|
import "pkg:/source/api/baserequest.bs"
|
|
|
|
import "pkg:/source/utils/config.bs"
|
|
|
|
import "pkg:/source/utils/misc.bs"
|
2023-11-11 00:36:58 +00:00
|
|
|
import "pkg:/source/utils/deviceCapabilities.bs"
|
2023-05-03 21:21:04 +00:00
|
|
|
|
2020-03-03 23:01:13 +00:00
|
|
|
sub init()
|
2023-10-30 22:04:09 +00:00
|
|
|
m.isFirstRun = true
|
2021-07-09 20:08:32 +00:00
|
|
|
m.top.overhangTitle = "Home"
|
|
|
|
m.top.optionsAvailable = true
|
2023-10-30 22:04:09 +00:00
|
|
|
m.postTask = createObject("roSGNode", "PostTask")
|
|
|
|
|
2023-12-02 04:05:15 +00:00
|
|
|
m.homeRows = m.top.findNode("homeRows")
|
|
|
|
|
|
|
|
m.fadeInFocusBitmap = m.top.findNode("fadeInFocusBitmap")
|
|
|
|
|
2023-06-01 12:43:27 +00:00
|
|
|
if m.global.session.user.settings["ui.home.splashBackground"] = true
|
2022-06-12 20:36:00 +00:00
|
|
|
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
|
2020-03-24 00:45:40 +00:00
|
|
|
end sub
|
|
|
|
|
2021-06-26 10:18:09 +00:00
|
|
|
sub refresh()
|
2023-12-02 04:05:15 +00:00
|
|
|
m.homeRows.focusBitmapBlendColor = "0xFFFFFFFF"
|
|
|
|
m.homeRows.callFunc("updateHomeRows")
|
2021-06-26 10:18:09 +00:00
|
|
|
end sub
|
2020-12-08 15:56:13 +00:00
|
|
|
|
2021-06-26 10:18:09 +00:00
|
|
|
sub loadLibraries()
|
2023-12-02 04:05:15 +00:00
|
|
|
m.homeRows.focusBitmapBlendColor = "0xFFFFFF00"
|
|
|
|
m.homeRows.callFunc("loadLibraries")
|
|
|
|
m.fadeInFocusBitmap.control = "start"
|
2022-05-30 12:57:40 +00:00
|
|
|
end sub
|
2023-10-30 22:04:09 +00:00
|
|
|
|
2023-11-01 03:38:33 +00:00
|
|
|
' JFScreen hook that gets ran as needed.
|
2023-11-11 00:26:52 +00:00
|
|
|
' Used to update the focus, the state of the data, and tells the server about the device profile
|
2023-10-30 22:04:09 +00:00
|
|
|
sub OnScreenShown()
|
2023-11-01 03:38:33 +00:00
|
|
|
if isValid(m.top.lastFocus)
|
2023-10-30 22:04:09 +00:00
|
|
|
m.top.lastFocus.setFocus(true)
|
|
|
|
else
|
|
|
|
m.top.setFocus(true)
|
|
|
|
end if
|
|
|
|
|
2023-11-14 15:45:13 +00:00
|
|
|
if not m.isFirstRun
|
|
|
|
refresh()
|
|
|
|
end if
|
2023-10-30 22:04:09 +00:00
|
|
|
|
|
|
|
' 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
|
|
|
|
|
2023-11-01 03:38:33 +00:00
|
|
|
' Triggered by m.postTask after completing a post.
|
|
|
|
' Empty the task data when finished.
|
2023-10-30 22:04:09 +00:00
|
|
|
sub postFinished()
|
|
|
|
m.postTask.unobserveField("responseCode")
|
2023-10-31 00:15:05 +00:00
|
|
|
m.postTask.callFunc("empty")
|
2023-10-30 22:04:09 +00:00
|
|
|
end sub
|