Refactored app registration (#362)
`AppManifest` is renamed to `AppRegistration` because it was confusing with the actual app manifest (as in: the properties file). Instead of passing a pointer, we're now passing the struct by value. I also moved some files around in `TactilityC/`.
This commit is contained in:
committed by
GitHub
parent
2cb413c3d1
commit
1e4234d895
@@ -2,6 +2,7 @@
|
||||
#include <Tactility/app/App.h>
|
||||
#include <Tactility/app/AppPaths.h>
|
||||
#include <Tactility/app/AppContext.h>
|
||||
#include <Tactility/app/ElfApp.h>
|
||||
#include <Tactility/file/FileLock.h>
|
||||
|
||||
extern "C" {
|
||||
@@ -10,6 +11,25 @@ constexpr auto* TAG = "tt_app";
|
||||
|
||||
#define HANDLE_AS_APP_CONTEXT(handle) ((tt::app::AppContext*)(handle))
|
||||
|
||||
void tt_app_register(
|
||||
const AppRegistration appRegistration
|
||||
) {
|
||||
#ifdef ESP_PLATFORM
|
||||
assert((appRegistration.createData == nullptr) == (appRegistration.destroyData == nullptr));
|
||||
tt::app::setElfAppParameters(
|
||||
appRegistration.createData,
|
||||
appRegistration.destroyData,
|
||||
appRegistration.onCreate,
|
||||
appRegistration.onDestroy,
|
||||
appRegistration.onShow,
|
||||
appRegistration.onHide,
|
||||
reinterpret_cast<tt::app::OnResult>(appRegistration.onResult)
|
||||
);
|
||||
#else
|
||||
tt_crash("TactilityC is not intended for PC/Simulator");
|
||||
#endif
|
||||
}
|
||||
|
||||
BundleHandle _Nullable tt_app_get_parameters(AppHandle handle) {
|
||||
return (BundleHandle)HANDLE_AS_APP_CONTEXT(handle)->getParameters().get();
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#include "tt_app_manifest.h"
|
||||
|
||||
#include <Tactility/Check.h>
|
||||
#include <Tactility/app/ElfApp.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
constexpr auto TAG = "tt_app";
|
||||
|
||||
void tt_app_register(
|
||||
const ExternalAppManifest* manifest
|
||||
) {
|
||||
#ifdef ESP_PLATFORM
|
||||
assert((manifest->createData == nullptr) == (manifest->destroyData == nullptr));
|
||||
tt::app::setElfAppParameters(
|
||||
manifest->createData,
|
||||
manifest->destroyData,
|
||||
manifest->onCreate,
|
||||
manifest->onDestroy,
|
||||
manifest->onShow,
|
||||
manifest->onHide,
|
||||
reinterpret_cast<tt::app::OnResult>(manifest->onResult)
|
||||
);
|
||||
#else
|
||||
tt_crash("TactilityC is not intended for PC/Simulator");
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "tt_app.h"
|
||||
#include "tt_app_alertdialog.h"
|
||||
#include "tt_app_manifest.h"
|
||||
#include "tt_app_selectiondialog.h"
|
||||
#include "tt_bundle.h"
|
||||
#include "tt_file.h"
|
||||
|
||||
Reference in New Issue
Block a user