Feature/app info screen (#69)

* Add app info screen

* Better app info page

* Small refactor for the navbar screens

* Changelog
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2023-04-18 16:52:15 -04:00
1 parent 8169c7223d
commit 32bcc1dfc0
11 files changed
+105 -66

No files matched your search

@@ -0,0 +1,52 @@
import "pkg:/source/utils/General.bs"
import "pkg:/components/AppInfoScreen/AppVersionTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
function Init()
m.displayNames = {
"version": "Playlet Version",
"lib_version": "Playlet Library Version",
"lib_version_latest": "Playlet Library Latest Version",
"lib_url": "Playlet Library URL",
"lib_url_type": "Playlet Library URL Type",
"git_commit_hash": "Playlet Git Commit Hash",
"lib_git_commit_hash": "Playlet Library Git Commit Hash",
"id": "App ID"
}
m.keyValueList = m.top.findNode("KeyValueListContent")
m.appInfo = GetAppInfo()
m.appInfo["lib_version_latest"] = "N/A"
m.appInfo["lib_url"] = "N/A"
m.appInfo["lib_url_type"] = "N/A"
scene = m.top.getScene()
if scene.playletLibLoadedUrl <> invalid
m.appInfo["lib_url"] = scene.playletLibLoadedUrl.link
m.appInfo["lib_url_type"] = scene.playletLibLoadedUrl.type
end if
UpdateKeyValueList()
GetLatestVersion()
end function
function UpdateKeyValueList()
while m.keyValueList.getChildCount() > 0
m.keyValueList.removeChildIndex(0)
end while
for each item in m.appInfo
value = `${m.displayNames[item]}: ${m.appInfo[item]}`
contentNode = m.keyValueList.createChild("ContentNode")
contentNode.title = value
end for
end function
function GetLatestVersion()
StartAsyncTask(AppVersionTask, {}, function(output as object) as void
if output.result.latest <> invalid
m.appInfo["lib_version_latest"] = output.result.latest
UpdateKeyValueList()
end if
end function)
end function