Fixes and improvements (#617)
This commit is contained in:
committed by
GitHub
parent
b03759a111
commit
0ff1627385
@@ -152,27 +152,19 @@ void updateApp(Context* ctx) {
|
||||
void updateViews(Context* ctx) {
|
||||
lvgl_toolbar_clear_actions(ctx->toolbar);
|
||||
auto app_id = ctx->entry.appId.c_str();
|
||||
AppManifest manifest;
|
||||
bool is_installed = app_manager_find_manifest(app_id, &manifest) == ERROR_NONE;
|
||||
ctx->spinner = lvgl_toolbar_add_spinner_action(ctx->toolbar);
|
||||
lv_obj_add_flag(ctx->spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(ctx->updateLabel, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
char install_path[128];
|
||||
if (app_get_install_path(app_id, install_path, sizeof(install_path)) != ERROR_NONE) {
|
||||
LOG_E(TAG, "Install path not found for %s", app_id);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string metadata_path = std::string(install_path) + "/manifest.properties";
|
||||
AppMetadata metadata;
|
||||
if (app_metadata_parse(metadata_path.c_str(), &metadata) != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to parse metadata at %s", metadata_path.c_str());
|
||||
return;
|
||||
}
|
||||
bool is_installed = app_get_install_path(app_id, install_path, sizeof(install_path)) == ERROR_NONE
|
||||
&& file::isFile(std::string(install_path) + "/manifest.properties");
|
||||
|
||||
if (is_installed) {
|
||||
if (metadata.app_version_code < ctx->entry.appVersionCode) {
|
||||
std::string metadata_path = std::string(install_path) + "/manifest.properties";
|
||||
AppMetadata metadata;
|
||||
if (app_metadata_parse(metadata_path.c_str(), &metadata) == ERROR_NONE
|
||||
&& metadata.app_version_code < ctx->entry.appVersionCode) {
|
||||
ctx->updateButton = lvgl_toolbar_add_image_button_action(ctx->toolbar, LV_SYMBOL_DOWNLOAD, onUpdatePressed, ctx);
|
||||
lv_obj_remove_flag(ctx->updateLabel, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
#include <Tactility/app/i2cscanner/I2cHelpers.h>
|
||||
#include <Tactility/app/i2cscanner/I2cScannerPrivate.h>
|
||||
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/RecursiveMutex.h>
|
||||
#include <Tactility/Timer.h>
|
||||
#include <Tactility/app/i2cscanner/I2cHelpers.h>
|
||||
#include <Tactility/app/i2cscanner/I2cScannerPrivate.h>
|
||||
|
||||
#include <app/event.h>
|
||||
#include <app/manager.h>
|
||||
#include <app/manifest.h>
|
||||
#include <app/paths.h>
|
||||
|
||||
#include <lvgl_window_manager/window_manager.h>
|
||||
|
||||
#include <tactility/drivers/i2c_controller.h>
|
||||
#include <tactility/log.h>
|
||||
#include <tactility/paths.h>
|
||||
#include <tactility/preferences.h>
|
||||
|
||||
#include <cassert>
|
||||
@@ -55,7 +56,7 @@ struct Context {
|
||||
|
||||
bool getPreferencesPath(std::string& outPath) {
|
||||
char root[128];
|
||||
if (paths_get_user_data_path(root, sizeof(root)) != ERROR_NONE) {
|
||||
if (app_paths_get_user_data_directory(manifest.id, root, sizeof(root)) != ERROR_NONE) {
|
||||
return false;
|
||||
}
|
||||
outPath = std::string(root) + "/i2c_scanner.properties";
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <Tactility/app/setup/Setup.h>
|
||||
|
||||
#include <tactility/paths.h>
|
||||
|
||||
#include <Tactility/StringUtils.h>
|
||||
#include <Tactility/app/timezone/TimeZone.h>
|
||||
#include <Tactility/app/wifimanage/WifiManage.h>
|
||||
@@ -13,7 +15,6 @@
|
||||
#include <lvgl_window_manager/window_manager.h>
|
||||
|
||||
#include <tactility/log.h>
|
||||
#include <tactility/paths.h>
|
||||
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
@@ -39,11 +40,11 @@ constexpr auto* TAG = "setup";
|
||||
namespace {
|
||||
|
||||
bool getCompletedMarkerPath(std::string& outPath) {
|
||||
char root[128];
|
||||
if (paths_get_user_data_path(root, sizeof(root)) != ERROR_NONE) {
|
||||
char path[128];
|
||||
if (paths_get_data_path(path, sizeof(path)) != ERROR_NONE) {
|
||||
return false;
|
||||
}
|
||||
outPath = std::string(root) + "/.setup_complete";
|
||||
outPath = std::string(path) + "/.setup_complete";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user