[FL-3400] External menu apps (#2849)

* FBT, applications: add MENUEXTERNAL app type
* FBT, uFBT: build MENUEXTERNAL as EXTERNAL app
* Loader menu: show external menu apps
* LFRFID: move to sd card
* FBT: always build External Applications list
* Archive: look for external apps path
* Infrared: move to sd card
* Apps: add "start" apps
* iButton: move to sd card
* BadUSB: move to sd card
* External apps: update icons
* GPIO: move to sd card
* Loader: look for external apps path
* U2F: move to sd
* SubGHz: move to sd
* Apps: "on_start" metapackage
* NFC: move to sd
* Sync f7 and f18

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Sergey Gavrilov
2023-07-10 12:03:41 +04:00
committed by GitHub
co-authored by Aleksandr Kutuzov
parent 4736fa876d
commit 9b2d80d6b7
38 changed files with 258 additions and 98 deletions
+15 -1
View File
@@ -4,7 +4,6 @@ App(
apptype=FlipperAppType.METAPACKAGE,
provides=[
"gpio",
"onewire",
"ibutton",
"infrared",
"lfrfid",
@@ -13,5 +12,20 @@ App(
"bad_usb",
"u2f",
"archive",
"main_apps_on_start",
],
)
App(
appid="main_apps_on_start",
name="On start hooks",
apptype=FlipperAppType.METAPACKAGE,
provides=[
"ibutton_start",
"onewire_start",
"subghz_start",
"infrared_start",
"lfrfid_start",
"nfc_start",
],
)
@@ -5,13 +5,14 @@
#include "../helpers/archive_browser.h"
#include "../views/archive_browser_view.h"
#include "archive/scenes/archive_scene.h"
#include <applications.h>
#define TAG "ArchiveSceneBrowser"
#define SCENE_STATE_DEFAULT (0)
#define SCENE_STATE_NEED_REFRESH (1)
const char* archive_get_flipper_app_name(ArchiveFileTypeEnum file_type) {
static const char* archive_get_flipper_app_name(ArchiveFileTypeEnum file_type) {
switch(file_type) {
case ArchiveFileTypeIButton:
return "iButton";
+3 -6
View File
@@ -1,15 +1,12 @@
App(
appid="bad_usb",
name="Bad USB",
apptype=FlipperAppType.APP,
apptype=FlipperAppType.MENUEXTERNAL,
entry_point="bad_usb_app",
cdefines=["APP_BAD_USB"],
requires=[
"gui",
"dialogs",
],
stack_size=2 * 1024,
icon="A_BadUsb_14",
order=70,
fap_libs=["assets"],
fap_icon="icon.png",
fap_category="USB",
)
Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

+3 -3
View File
@@ -1,12 +1,12 @@
App(
appid="gpio",
name="GPIO",
apptype=FlipperAppType.APP,
apptype=FlipperAppType.MENUEXTERNAL,
entry_point="gpio_app",
cdefines=["APP_GPIO"],
requires=["gui"],
stack_size=1 * 1024,
icon="A_GPIO_14",
order=50,
fap_libs=["assets"],
fap_icon="icon.png",
fap_category="GPIO",
)
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

+4 -8
View File
@@ -1,25 +1,21 @@
App(
appid="ibutton",
name="iButton",
apptype=FlipperAppType.APP,
apptype=FlipperAppType.MENUEXTERNAL,
targets=["f7"],
entry_point="ibutton_app",
cdefines=["APP_IBUTTON"],
requires=[
"gui",
"dialogs",
],
provides=["ibutton_start"],
icon="A_iButton_14",
stack_size=2 * 1024,
order=60,
fap_libs=["assets"],
fap_icon="icon.png",
fap_category="iButton",
)
App(
appid="ibutton_start",
apptype=FlipperAppType.STARTUP,
targets=["f7"],
entry_point="ibutton_on_system_start",
requires=["ibutton"],
order=60,
)
Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

+4 -8
View File
@@ -1,25 +1,21 @@
App(
appid="infrared",
name="Infrared",
apptype=FlipperAppType.APP,
apptype=FlipperAppType.MENUEXTERNAL,
entry_point="infrared_app",
targets=["f7"],
cdefines=["APP_INFRARED"],
requires=[
"gui",
"dialogs",
],
provides=["infrared_start"],
icon="A_Infrared_14",
stack_size=3 * 1024,
order=40,
fap_libs=["assets"],
fap_icon="icon.png",
fap_category="Infrared",
)
App(
appid="infrared_start",
apptype=FlipperAppType.STARTUP,
targets=["f7"],
entry_point="infrared_on_system_start",
requires=["infrared"],
order=20,
)
Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

+4 -10
View File
@@ -1,27 +1,21 @@
App(
appid="lfrfid",
name="125 kHz RFID",
apptype=FlipperAppType.APP,
apptype=FlipperAppType.MENUEXTERNAL,
targets=["f7"],
entry_point="lfrfid_app",
cdefines=["APP_LF_RFID"],
requires=[
"gui",
"dialogs",
],
provides=[
"lfrfid_start",
],
icon="A_125khz_14",
stack_size=2 * 1024,
order=20,
fap_libs=["assets"],
fap_icon="icon.png",
fap_category="RFID",
)
App(
appid="lfrfid_start",
targets=["f7"],
apptype=FlipperAppType.STARTUP,
entry_point="lfrfid_on_system_start",
requires=["lfrfid"],
order=50,
)
Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

+5 -8
View File
@@ -1,24 +1,21 @@
App(
appid="nfc",
name="NFC",
apptype=FlipperAppType.APP,
apptype=FlipperAppType.MENUEXTERNAL,
targets=["f7"],
entry_point="nfc_app",
cdefines=["APP_NFC"],
requires=[
"gui",
"dialogs",
],
provides=["nfc_start"],
icon="A_NFC_14",
stack_size=5 * 1024,
order=30,
fap_libs=["assets"],
fap_icon="icon.png",
fap_category="NFC",
)
App(
appid="nfc_start",
targets=["f7"],
apptype=FlipperAppType.STARTUP,
entry_point="nfc_on_system_start",
requires=["nfc"],
order=30,
)
Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

@@ -1,14 +1,6 @@
App(
appid="onewire",
name="1-Wire",
apptype=FlipperAppType.METAPACKAGE,
provides=["onewire_start"],
)
App(
appid="onewire_start",
apptype=FlipperAppType.STARTUP,
entry_point="onewire_on_system_start",
requires=["onewire"],
order=60,
)
+5 -9
View File
@@ -1,25 +1,21 @@
App(
appid="subghz",
name="Sub-GHz",
apptype=FlipperAppType.APP,
apptype=FlipperAppType.MENUEXTERNAL,
targets=["f7"],
entry_point="subghz_app",
cdefines=["APP_SUBGHZ"],
requires=[
"gui",
"cli",
"dialogs",
],
provides=["subghz_start"],
icon="A_Sub1ghz_14",
stack_size=3 * 1024,
order=10,
fap_libs=["assets", "hwdrivers"],
fap_icon="icon.png",
fap_category="Sub-GHz",
)
App(
appid="subghz_start",
targets=["f7"],
apptype=FlipperAppType.STARTUP,
entry_point="subghz_on_system_start",
requires=["subghz"],
order=40,
)
Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

+3 -6
View File
@@ -1,15 +1,12 @@
App(
appid="u2f",
name="U2F",
apptype=FlipperAppType.APP,
apptype=FlipperAppType.MENUEXTERNAL,
entry_point="u2f_app",
cdefines=["APP_U2F"],
requires=[
"gui",
"dialogs",
],
stack_size=2 * 1024,
icon="A_U2F_14",
order=80,
fap_libs=["assets"],
fap_category="USB",
fap_icon="icon.png",
)
Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

+12
View File
@@ -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;
+18
View File
@@ -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();
@@ -379,6 +389,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);
+19 -2
View File
@@ -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(