mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-09 05:49:09 -07:00
Merge branch 'ofw-dev' into dev
This commit is contained in:
@@ -17,6 +17,12 @@ typedef struct {
|
||||
const FlipperInternalApplicationFlag flags;
|
||||
} FlipperInternalApplication;
|
||||
|
||||
typedef struct {
|
||||
const char* name;
|
||||
const Icon* icon;
|
||||
const char* path;
|
||||
} FlipperExternalApplication;
|
||||
|
||||
typedef void (*FlipperInternalOnStartHook)(void);
|
||||
|
||||
extern const char* FLIPPER_AUTORUN_APP_NAME;
|
||||
@@ -52,3 +58,9 @@ extern const FlipperInternalApplication FLIPPER_ARCHIVE;
|
||||
*/
|
||||
extern const FlipperInternalApplication FLIPPER_SETTINGS_APPS[];
|
||||
extern const size_t FLIPPER_SETTINGS_APPS_COUNT;
|
||||
|
||||
/* External Menu Apps list
|
||||
* Spawned by loader
|
||||
*/
|
||||
extern const FlipperExternalApplication FLIPPER_EXTERNAL_APPS[];
|
||||
extern const size_t FLIPPER_EXTERNAL_APPS_COUNT;
|
||||
|
||||
@@ -170,6 +170,16 @@ static const FlipperInternalApplication* loader_find_application_by_name(const c
|
||||
return application;
|
||||
}
|
||||
|
||||
static const char* loader_find_external_application_by_name(const char* app_name) {
|
||||
for(size_t i = 0; i < FLIPPER_EXTERNAL_APPS_COUNT; i++) {
|
||||
if(strcmp(FLIPPER_EXTERNAL_APPS[i].name, app_name) == 0) {
|
||||
return FLIPPER_EXTERNAL_APPS[i].path;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void loader_start_app_thread(Loader* loader, FlipperInternalApplicationFlag flags) {
|
||||
// setup heap trace
|
||||
FuriHalRtcHeapTrackMode mode = furi_hal_rtc_get_heap_track_mode();
|
||||
@@ -411,6 +421,14 @@ static LoaderStatus loader_do_start_by_name(
|
||||
break;
|
||||
}
|
||||
|
||||
// check External Applications
|
||||
{
|
||||
const char* path = loader_find_external_application_by_name(name);
|
||||
if(path) {
|
||||
name = path;
|
||||
}
|
||||
}
|
||||
|
||||
// check external apps
|
||||
{
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
@@ -52,12 +52,18 @@ static void loader_menu_start(const char* name) {
|
||||
furi_record_close(RECORD_LOADER);
|
||||
}
|
||||
|
||||
static void loader_menu_callback(void* context, uint32_t index) {
|
||||
static void loader_menu_apps_callback(void* context, uint32_t index) {
|
||||
UNUSED(context);
|
||||
const char* name = FLIPPER_APPS[index].name;
|
||||
loader_menu_start(name);
|
||||
}
|
||||
|
||||
static void loader_menu_external_apps_callback(void* context, uint32_t index) {
|
||||
UNUSED(context);
|
||||
const char* path = FLIPPER_EXTERNAL_APPS[index].path;
|
||||
loader_menu_start(path);
|
||||
}
|
||||
|
||||
static void loader_menu_applications_callback(void* context, uint32_t index) {
|
||||
UNUSED(index);
|
||||
UNUSED(context);
|
||||
@@ -89,13 +95,24 @@ static uint32_t loader_menu_exit(void* context) {
|
||||
|
||||
static void loader_menu_build_menu(LoaderMenuApp* app, LoaderMenu* menu) {
|
||||
size_t i;
|
||||
|
||||
for(i = 0; i < FLIPPER_EXTERNAL_APPS_COUNT; i++) {
|
||||
menu_add_item(
|
||||
app->primary_menu,
|
||||
FLIPPER_EXTERNAL_APPS[i].name,
|
||||
FLIPPER_EXTERNAL_APPS[i].icon,
|
||||
i,
|
||||
loader_menu_external_apps_callback,
|
||||
(void*)menu);
|
||||
}
|
||||
|
||||
for(i = 0; i < FLIPPER_APPS_COUNT; i++) {
|
||||
menu_add_item(
|
||||
app->primary_menu,
|
||||
FLIPPER_APPS[i].name,
|
||||
FLIPPER_APPS[i].icon,
|
||||
i,
|
||||
loader_menu_callback,
|
||||
loader_menu_apps_callback,
|
||||
(void*)menu);
|
||||
}
|
||||
menu_add_item(
|
||||
|
||||
Reference in New Issue
Block a user