Ken Van Hoeylandt 3ea02d912f
Merge develop into main (#167)
- WiFi Connect app is now hidden by default, but accessible at the bottom of the WiFi Manage app when WiFi is turned on.
- WiFi service now turns on WiFi when calling connect() and WiFi is not on.
- Removed `blocking` option for `service::loader::startApp()`. This feature was unused and complex.
- Various apps: Moved private headers into Private/ folder.
- Various apps: created start() function for easy starting.
- Added documentation to all TactilityC APIs
- Refactored various `enum` into `class enum`
- Refactor M5Stack `initBoot()` (but VBus is still 0V for some reason)
2025-01-17 19:37:42 +01:00

47 lines
1.1 KiB
C++

#include "app/files/FilesPrivate.h"
#include "app/AppContext.h"
#include "Assets.h"
#include "service/loader/Loader.h"
#include <memory>
namespace tt::app::files {
#define TAG "files_app"
extern const AppManifest manifest;
/** Returns the app data if the app is active. Note that this could clash if the same app is started twice and a background thread is slow. */
static void onShow(AppContext& app, lv_obj_t* parent) {
auto files = std::static_pointer_cast<Files>(app.getData());
files->onShow(parent);
}
static void onStart(AppContext& app) {
auto files = std::make_shared<Files>();
app.setData(files);
}
static void onResult(AppContext& app, Result result, const Bundle& bundle) {
auto files = std::static_pointer_cast<Files>(app.getData());
files->onResult(result, bundle);
}
extern const AppManifest manifest = {
.id = "Files",
.name = "Files",
.icon = TT_ASSETS_APP_ICON_FILES,
.type = TypeHidden,
.onStart = onStart,
.onShow = onShow,
.onResult = onResult
};
void start() {
service::loader::startApp(manifest.id);
}
} // namespace