0367b95f27
- Add parseAppFlagsString() in AppManifestParsing.cpp to parse comma-separated flags (HideStatusBar, Hidden, None) - Parse [app]flags in V1 and app.flags in V2 manifests - Loader already supports HideStatusBar, GuiService hides statusbarWidget when set - Enables fullscreen for ELF apps (e.g. BibleVerse, BookPlayer) without firmware recompilation of internal manifests - Add tests for flag parsing (38 tests passing) - Tested on es3c28p /dev/cu.usbmodem1101 @ 192.168.68.133 with HelloWorld app
84 lines
2.0 KiB
C++
84 lines
2.0 KiB
C++
#include <Tactility/app/AppManifestParsing.h>
|
|
#include <Tactility/app/AppManifestParsingInternal.h>
|
|
|
|
#include <tactility/log.h>
|
|
|
|
namespace tt::app {
|
|
|
|
constexpr auto* TAG = "AppManifestV2";
|
|
|
|
bool parseManifestV2(const std::map<std::string, std::string>& map, AppManifest& manifest) {
|
|
// manifest
|
|
|
|
std::string manifest_version;
|
|
if (!getValueFromManifest(map, "manifest.version", manifest_version)) {
|
|
return false;
|
|
}
|
|
|
|
if (!isValidManifestVersion(manifest_version)) {
|
|
LOG_E(TAG, "Invalid version");
|
|
return false;
|
|
}
|
|
|
|
// app
|
|
|
|
if (!getValueFromManifest(map, "app.id", manifest.appId)) {
|
|
return false;
|
|
}
|
|
|
|
if (!isValidId(manifest.appId)) {
|
|
LOG_E(TAG, "Invalid app id");
|
|
return false;
|
|
}
|
|
|
|
if (!getValueFromManifest(map, "app.name", manifest.appName)) {
|
|
return false;
|
|
}
|
|
|
|
if (!isValidName(manifest.appName)) {
|
|
LOG_E(TAG, "Invalid app name");
|
|
return false;
|
|
}
|
|
|
|
if (!getValueFromManifest(map, "app.version.name", manifest.appVersionName)) {
|
|
return false;
|
|
}
|
|
|
|
if (!isValidAppVersionName(manifest.appVersionName)) {
|
|
LOG_E(TAG, "Invalid app version name");
|
|
return false;
|
|
}
|
|
|
|
std::string version_code_string;
|
|
if (!getValueFromManifest(map, "app.version.code", version_code_string)) {
|
|
return false;
|
|
}
|
|
|
|
if (!isValidAppVersionCode(version_code_string)) {
|
|
LOG_E(TAG, "Invalid app version code");
|
|
return false;
|
|
}
|
|
|
|
manifest.appVersionCode = std::stoull(version_code_string);
|
|
|
|
// target
|
|
|
|
if (!getValueFromManifest(map, "target.sdk", manifest.targetSdk)) {
|
|
return false;
|
|
}
|
|
|
|
if (!getValueFromManifest(map, "target.platforms", manifest.targetPlatforms)) {
|
|
return false;
|
|
}
|
|
|
|
// Optional: app.flags - e.g. "HideStatusBar" or "HideStatusBar,Hidden"
|
|
auto flags_it = map.find("app.flags");
|
|
if (flags_it != map.end()) {
|
|
manifest.appFlags = parseAppFlagsString(flags_it->second);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|