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