36 lines
988 B
Plaintext
36 lines
988 B
Plaintext
import "pkg:/source/utils/General.bs"
|
|
import "pkg:/source/roku_modules/rokupromise/Promise.brs"
|
|
|
|
function Init()
|
|
m.versionLabel = m.top.findNode("VersionLabel")
|
|
m.top.url = `http://${GetLocalIpAddress()}:8888`
|
|
appInfo = GetAppInfo()
|
|
m.currentVersion = appInfo.version
|
|
SetVersionLabel(m.currentVersion, "N/A")
|
|
GetLatestVersion()
|
|
end function
|
|
|
|
function OnUrlSet()
|
|
url = m.top.url
|
|
|
|
qrCode = m.top.findNode("SettingsQRPoster")
|
|
qrCode.text = url
|
|
|
|
urlLabel = m.top.findNode("urlLabel")
|
|
urlLabel.text = url
|
|
end function
|
|
|
|
function GetLatestVersion()
|
|
createTaskPromise("AppVersionTask", {
|
|
input: {}
|
|
}).then(function(task as object) as void
|
|
if task.output.latest <> invalid
|
|
SetVersionLabel(m.currentVersion, task.output.latest)
|
|
end if
|
|
end function)
|
|
end function
|
|
|
|
function SetVersionLabel(current as string, latest as string)
|
|
m.versionLabel.text = `Version: ${current} | Latest: ${latest}`
|
|
end function
|