mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge branch 'unload-anim-before-fap' of https://github.com/Willy-JL/flipperzero-firmware into mntm-dev
This commit is contained in:
@@ -60,11 +60,29 @@ LoaderStatus
|
||||
|
||||
return result.value;
|
||||
}
|
||||
LoaderStatus loader_start_with_gui_error(Loader* loader, const char* name, const char* args) {
|
||||
furi_check(loader);
|
||||
furi_check(name);
|
||||
|
||||
static void loader_show_gui_error(LoaderStatus status, FuriString* error_message) {
|
||||
// TODO FL-3522: we have many places where we can emit a double start, ex: desktop, menu
|
||||
// so i prefer to not show LoaderStatusErrorAppStarted error message for now
|
||||
if(status == LoaderStatusErrorUnknownApp || status == LoaderStatusErrorInternal) {
|
||||
FuriString* error_message = furi_string_alloc();
|
||||
LoaderStatus status = loader_start(loader, name, args, error_message);
|
||||
|
||||
if(status == LoaderStatusErrorUnknownApp &&
|
||||
loader_find_external_application_by_name(name) != NULL) {
|
||||
// Special case for external apps
|
||||
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
DialogMessage* message = dialog_message_alloc();
|
||||
dialog_message_set_header(message, "Update needed", 64, 3, AlignCenter, AlignTop);
|
||||
dialog_message_set_buttons(message, NULL, NULL, NULL);
|
||||
dialog_message_set_icon(message, &I_WarningDolphinFlip_45x42, 83, 22);
|
||||
dialog_message_set_text(
|
||||
message, "Update firmware\nto run this app", 3, 26, AlignLeft, AlignTop);
|
||||
dialog_message_show(dialogs, message);
|
||||
dialog_message_free(message);
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
} else if(status == LoaderStatusErrorUnknownApp || status == LoaderStatusErrorInternal) {
|
||||
// TODO FL-3522: we have many places where we can emit a double start, ex: desktop, menu
|
||||
// so i prefer to not show LoaderStatusErrorAppStarted error message for now
|
||||
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
DialogMessage* message = dialog_message_alloc();
|
||||
dialog_message_set_header(message, "Error", 64, 0, AlignCenter, AlignTop);
|
||||
@@ -82,15 +100,7 @@ static void loader_show_gui_error(LoaderStatus status, FuriString* error_message
|
||||
dialog_message_free(message);
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
}
|
||||
}
|
||||
|
||||
LoaderStatus loader_start_with_gui_error(Loader* loader, const char* name, const char* args) {
|
||||
furi_check(loader);
|
||||
furi_check(name);
|
||||
|
||||
FuriString* error_message = furi_string_alloc();
|
||||
LoaderStatus status = loader_start(loader, name, args, error_message);
|
||||
loader_show_gui_error(status, error_message);
|
||||
furi_string_free(error_message);
|
||||
return status;
|
||||
}
|
||||
@@ -99,11 +109,11 @@ void loader_start_detached_with_gui_error(Loader* loader, const char* name, cons
|
||||
furi_check(loader);
|
||||
furi_check(name);
|
||||
|
||||
LoaderMessage message;
|
||||
|
||||
message.type = LoaderMessageTypeStartByNameDetachedWithGuiError;
|
||||
message.start.name = name ? strdup(name) : NULL;
|
||||
message.start.args = args ? strdup(args) : NULL;
|
||||
LoaderMessage message = {
|
||||
.type = LoaderMessageTypeStartByNameDetachedWithGuiError,
|
||||
.start.name = name ? strdup(name) : NULL,
|
||||
.start.args = args ? strdup(args) : NULL,
|
||||
};
|
||||
furi_message_queue_put(loader->queue, &message, FuriWaitForever);
|
||||
}
|
||||
|
||||
@@ -739,13 +749,9 @@ int32_t loader_srv(void* p) {
|
||||
api_lock_unlock(message.api_lock);
|
||||
break;
|
||||
case LoaderMessageTypeStartByNameDetachedWithGuiError: {
|
||||
FuriString* error_message = furi_string_alloc();
|
||||
LoaderStatus status = loader_do_start_by_name(
|
||||
loader, message.start.name, message.start.args, error_message);
|
||||
loader_show_gui_error(status, error_message);
|
||||
loader_start_with_gui_error(loader, message.start.name, message.start.args);
|
||||
if(message.start.name) free((void*)message.start.name);
|
||||
if(message.start.args) free((void*)message.start.args);
|
||||
furi_string_free(error_message);
|
||||
break;
|
||||
}
|
||||
case LoaderMessageTypeShowMenu:
|
||||
|
||||
@@ -34,7 +34,7 @@ typedef struct {
|
||||
* @param[in] name application name or id
|
||||
* @param[in] args application arguments
|
||||
* @param[out] error_message detailed error message, can be NULL
|
||||
* @return LoaderStatus
|
||||
* @return LoaderStatus
|
||||
*/
|
||||
LoaderStatus
|
||||
loader_start(Loader* instance, const char* name, const char* args, FuriString* error_message);
|
||||
@@ -44,19 +44,19 @@ LoaderStatus
|
||||
* @param[in] instance loader instance
|
||||
* @param[in] name application name or id
|
||||
* @param[in] args application arguments
|
||||
* @return LoaderStatus
|
||||
* @return LoaderStatus
|
||||
*/
|
||||
LoaderStatus loader_start_with_gui_error(Loader* loader, const char* name, const char* args);
|
||||
|
||||
/**
|
||||
* @brief Start application detached with GUI error message
|
||||
* @param[in] instance loader instance
|
||||
* @param[in] name application name
|
||||
* @param[in] name application name or id
|
||||
* @param[in] args application arguments
|
||||
*/
|
||||
void loader_start_detached_with_gui_error(Loader* loader, const char* name, const char* args);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Lock application start
|
||||
* @param[in] instance loader instance
|
||||
* @return true on success
|
||||
|
||||
@@ -33,8 +33,8 @@ typedef enum {
|
||||
LoaderMessageTypeLock,
|
||||
LoaderMessageTypeUnlock,
|
||||
LoaderMessageTypeIsLocked,
|
||||
|
||||
LoaderMessageTypeStartByNameDetachedWithGuiError,
|
||||
|
||||
LoaderMessageTypeShowSettings,
|
||||
} LoaderMessageType;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
entry,status,name,type,params
|
||||
Version,+,60.4,,
|
||||
Version,+,60.5,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/cli/cli.h,,
|
||||
Header,+,applications/services/cli/cli_vcp.h,,
|
||||
@@ -1748,6 +1748,7 @@ Function,+,loader_is_locked,_Bool,Loader*
|
||||
Function,+,loader_lock,_Bool,Loader*
|
||||
Function,+,loader_show_menu,void,Loader*
|
||||
Function,+,loader_start,LoaderStatus,"Loader*, const char*, const char*, FuriString*"
|
||||
Function,+,loader_start_detached_with_gui_error,void,"Loader*, const char*, const char*"
|
||||
Function,+,loader_start_with_gui_error,LoaderStatus,"Loader*, const char*, const char*"
|
||||
Function,+,loader_unlock,void,Loader*
|
||||
Function,+,loading_alloc,Loading*,
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
entry,status,name,type,params
|
||||
Version,+,60.4,,
|
||||
Version,+,60.5,,
|
||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||
Header,+,applications/main/archive/helpers/archive_helpers_ext.h,,
|
||||
Header,+,applications/main/subghz/subghz_fap.h,,
|
||||
|
||||
|
Reference in New Issue
Block a user