Add playlet lib url to settings

This commit is contained in:
Brahim Hadriche committed 2023-02-04 18:56:11 -05:00
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'