Add playlet lib url to settings
This commit is contained in:
1 parent
98e07877e3
commit
aea2cb39d7
4 files changed
+35
-10
No files matched your search
@@ -5,11 +5,18 @@ import "pkg:/components/SettingsScreen/AppVersionTask.bs"
|
||||
|
||||
function Init()
|
||||
m.versionLabel = m.top.findNode("VersionLabel")
|
||||
m.playletLibUrlLabel = m.top.findNode("PlayletLibUrlLabel")
|
||||
|
||||
m.top.url = `http://${GetLocalIpAddress()}:8888`
|
||||
|
||||
m.appInfo = GetAppInfo()
|
||||
appInfo = GetAppInfo()
|
||||
m.top.appVersion = appInfo.version
|
||||
m.top.libVersion = appInfo.lib_version
|
||||
|
||||
SetVersionLabel(m.appInfo.version, m.appInfo.lib_version, "N/A")
|
||||
scene = m.top.getScene()
|
||||
if scene.playletLibLoadedUrl <> invalid
|
||||
m.top.libUrl = `[${scene.playletLibLoadedUrl.type}|${scene.playletLibLoadedUrl.link}]`
|
||||
end if
|
||||
GetLatestVersion()
|
||||
end function
|
||||
|
||||
@@ -26,11 +33,15 @@ end function
|
||||
function GetLatestVersion()
|
||||
StartAsyncTask(AppVersionTask, {}, function(output as object) as void
|
||||
if output.result.latest <> invalid
|
||||
SetVersionLabel(m.appInfo.version, m.appInfo.lib_version, output.result.latest)
|
||||
m.top.latestVersion = output.result.latest
|
||||
end if
|
||||
end function)
|
||||
end function
|
||||
|
||||
function SetVersionLabel(appVersion as string, libVersion as string, latest as string)
|
||||
m.versionLabel.text = `Playlet: ${appVersion} | Playlet-Lib: ${libVersion} | Latest: ${latest}`
|
||||
function SetVersionLabel()
|
||||
m.versionLabel.text = `Playlet: ${m.top.appVersion} | Playlet-Lib: ${m.top.libVersion} | Latest: ${m.top.latestVersion}`
|
||||
end function
|
||||
|
||||
function SetPlayletLibUrlLabel()
|
||||
m.playletLibUrlLabel.text = `Playlet-Lib: ${m.top.libUrl}`
|
||||
end function
|
||||
@@ -2,16 +2,28 @@
|
||||
|
||||
<component name="SettingsScreen" extends="Group">
|
||||
<interface>
|
||||
<field id="appVersion" type="string" value="N/A" onChange="SetVersionLabel" />
|
||||
<field id="libVersion" type="string" value="N/A" onChange="SetVersionLabel" />
|
||||
<field id="latestVersion" type="string" value="N/A" onChange="SetVersionLabel" />
|
||||
<field id="libUrl" type="string" value="N/A" onChange="SetPlayletLibUrlLabel" />
|
||||
<field id="url" type="string" onChange="OnUrlSet" />
|
||||
</interface>
|
||||
<children>
|
||||
<Label
|
||||
id='VersionLabel'
|
||||
height='50'
|
||||
height='60'
|
||||
width='1280'
|
||||
font='font:MediumBoldSystemFont'
|
||||
horizAlign="center"
|
||||
translation="[0,100]"
|
||||
translation="[0,80]"
|
||||
/>
|
||||
<Label
|
||||
id='PlayletLibUrlLabel'
|
||||
height='60'
|
||||
width='1280'
|
||||
font='font:SmallestBoldSystemFont'
|
||||
horizAlign="center"
|
||||
translation="[0,120]"
|
||||
/>
|
||||
<QRPoster
|
||||
id='SettingsQRPoster'
|
||||
|
||||
@@ -51,18 +51,19 @@ function LoadPlayletLib() as void
|
||||
end function
|
||||
|
||||
function OnLoadStatusChanged() as void
|
||||
uri = m.playletLibUrls[m.playletLibUrlIndex].link
|
||||
libUrl = m.playletLibUrls[m.playletLibUrlIndex]
|
||||
if m.lib.loadStatus = "ready"
|
||||
RemoveComponentLibrary()
|
||||
?"Playlet lib loaded from " uri
|
||||
?"Playlet lib loaded from " libUrl.link
|
||||
scene = m.top.getScene()
|
||||
scene.playletLibLoadedUrl = libUrl
|
||||
container = scene.findNode("MainSceneContainer")
|
||||
container.createChild("PlayletLib:MainScene")
|
||||
return
|
||||
end if
|
||||
|
||||
if m.lib.loadStatus = "failed"
|
||||
?"Playlet lib failed to load from " uri
|
||||
?"Playlet lib failed to load from " libUrl.link
|
||||
' Try next url
|
||||
m.playletLibUrlIndex += 1
|
||||
LoadPlayletLib()
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<field id="exitChannel" type="bool" alwaysNotify="true" />
|
||||
<field id="launchArgs" type="assocarray" />
|
||||
<field id="inputArgs" type="assocarray" alwaysNotify="true" />
|
||||
<field id="playletLibLoadedUrl" type="assocarray" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/Dialog.bs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/Manifest.bs" />
|
||||
|
||||
Reference in new issue
Block a user