Files
playlet-piped/playlet-lib/src/components/Screens/AppInfoScreen/AppInfoScreen.bs
T
Brahim Hadriche 82dea9af37 Remove asynctask code (#666)
* Remove asynctask code

* add job test example

* Fix testing

* Fix a couple of imports
2025-06-22 17:39:58 -04:00

60 lines
1.6 KiB
Plaintext

import "pkg:/source/utils/Types.bs"
function Init()
' TODO:P2 Add tooltip to each field with description of what it means
m.displayNames = [{
key: "app_version"
displayText: "Playlet App Version"
}, {
key: "lib_version"
displayText: "Playlet Library Version"
}, {
key: "lib_version_latest"
displayText: "Playlet Library Latest Version"
}, {
key: "lib_url"
displayText: "Playlet Library URL"
}, {
key: "lib_url_type"
displayText: "Playlet Library URL Type"
}, {
key: "app_git_commit_hash"
displayText: "Playlet App Git Commit Hash"
}, {
key: "lib_git_commit_hash"
displayText: "Playlet Library Git Commit Hash"
}, {
key: "id"
displayText: "App ID"
}]
m.keyValueList = m.top.findNode("KeyValueListContent")
end function
function OnNodeReady()
m.appInfo = m.applicationInfo@.GetAppInfo()
UpdateKeyValueList()
if m.appInfo.lib_version_latest = "N/A"
m.applicationInfo.ObserveFieldScoped("lib_version_latest", FuncName(OnAppInfoChanged))
end if
end function
function OnAppInfoChanged()
m.appInfo["lib_version_latest"] = m.applicationInfo.lib_version_latest
UpdateKeyValueList()
end function
function UpdateKeyValueList()
while m.keyValueList.getChildCount() > 0
m.keyValueList.removeChildIndex(0)
end while
for each item in m.displayNames
value = `${item.displayText}: ${m.appInfo[item.key]}`
contentNode = m.keyValueList.createChild("ContentNode")
contentNode.title = value
end for
end function