Merge develop into main (#348)
## App state Improved app state management in `LoaderService` and `GuiService`: - Re-ordered some of the state transitions - Hardened `GuiService` for repeated events (that might trigger a re-render of an app that's already rendered) - Validate state transitions in `LoaderService` and crash if an app transitions from the wrong state to the next one. ## LoaderService - Removed `tt::loader::` functions and expose `LoaderService` interface publicly. - Implement `stopAll()` and `stopAll(id)` which stops all instances of an app, including any apps that were launched by it. - Rename `stop()` functions to `stopTop()` - Created `stopTop(id)` which only stops the top-most app when the app id matches. - Moved `loader::LoaderEvent` to `loader::LoaderService::Event` - Changed app instance `std::stack` to `std::vector` ## Improvements - `ElfApp`: error 22 now shows a hint that `main()` might be missing - Starting, installing and uninstalling apps now stops any running app (and its children) on the stack ## Bugfixes - `HttpdReq` out of memory issue now shows an error message and doesn't crash anymore (this would happen on devices without PSRAM with WiFi active, when an app was installed) - `GuiService::hideApp()` lock should not wait for timeout and now waits indefinitely - `Buildscript/release-sdk-current.sh` deletes the previous local release before building a new one ## Code correctness - App classes were made `final` - Apps that had a `void start()` now have a `LaunchId start()` - `tt::app::State`: renamed `Started` to `Created` and `Stopped` to `Destroyed` to properly reflect earlier name changes
This commit is contained in:
committed by
GitHub
parent
dcf28d0868
commit
f6cdabf3c0
@@ -1,32 +1,31 @@
|
||||
#include "Tactility/app/inputdialog/InputDialog.h"
|
||||
|
||||
#include "Tactility/lvgl/Toolbar.h"
|
||||
#include "Tactility/service/loader/Loader.h"
|
||||
#include <Tactility/app/inputdialog/InputDialog.h>
|
||||
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
namespace tt::app::inputdialog {
|
||||
|
||||
#define PARAMETER_BUNDLE_KEY_TITLE "title"
|
||||
#define PARAMETER_BUNDLE_KEY_MESSAGE "message"
|
||||
#define PARAMETER_BUNDLE_KEY_PREFILLED "prefilled"
|
||||
#define RESULT_BUNDLE_KEY_RESULT "result"
|
||||
constexpr auto* PARAMETER_BUNDLE_KEY_TITLE = "title";
|
||||
constexpr auto* PARAMETER_BUNDLE_KEY_MESSAGE = "message";
|
||||
constexpr auto* PARAMETER_BUNDLE_KEY_PREFILLED = "prefilled";
|
||||
constexpr auto* RESULT_BUNDLE_KEY_RESULT = "result";
|
||||
|
||||
#define DEFAULT_TITLE "Input"
|
||||
constexpr auto* DEFAULT_TITLE = "Input";
|
||||
|
||||
#define TAG "input_dialog"
|
||||
constexpr auto* TAG = "InputDialog";
|
||||
|
||||
extern const AppManifest manifest;
|
||||
class InputDialogApp;
|
||||
|
||||
void start(const std::string& title, const std::string& message, const std::string& prefilled) {
|
||||
LaunchId start(const std::string& title, const std::string& message, const std::string& prefilled) {
|
||||
auto bundle = std::make_shared<Bundle>();
|
||||
bundle->putString(PARAMETER_BUNDLE_KEY_TITLE, title);
|
||||
bundle->putString(PARAMETER_BUNDLE_KEY_MESSAGE, message);
|
||||
bundle->putString(PARAMETER_BUNDLE_KEY_PREFILLED, prefilled);
|
||||
service::loader::startApp(manifest.appId, bundle);
|
||||
return app::start(manifest.appId, bundle);
|
||||
}
|
||||
|
||||
std::string getResult(const Bundle& bundle) {
|
||||
@@ -44,7 +43,7 @@ static std::string getTitleParameter(const std::shared_ptr<const Bundle>& bundle
|
||||
}
|
||||
}
|
||||
|
||||
class InputDialogApp : public App {
|
||||
class InputDialogApp final : public App {
|
||||
|
||||
static void createButton(lv_obj_t* parent, const std::string& text, void* callbackContext) {
|
||||
lv_obj_t* button = lv_button_create(parent);
|
||||
@@ -73,7 +72,7 @@ class InputDialogApp : public App {
|
||||
setResult(Result::Cancelled);
|
||||
|
||||
}
|
||||
service::loader::stopApp();
|
||||
stop(manifest.appId);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user