Files
playlet-piped/playlet-lib/src/components/Screens/AppInfoScreen/AppInfoScreen.bs
T

60 lines
1.6 KiB
Plaintext

import "pkg:/source/asyncTask/asyncTask.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(invalid)
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