Files
playlet-piped/playlet-lib/src/components/Screens/AppInfoScreen/AppInfoScreen.bs
T
Brahim Hadriche 5335a0273b Feature/optimize task imports (#257)
* Prune empty code files

* delete file

* Restore

* refactor

* fix warnings

* Fix tasks

* Add diag

* tweak

* Log load times

* changelog
2024-01-08 19:38:39 -05:00

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()
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