mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-29 16:25:47 +03:00
Allow api mismatch bypass again :C
for those who explicitly doesn't update their manually installed apps and want to ignore warnings and issues caused by using outdated apps
This commit is contained in:
parent
5e2d01f159
commit
380734f804
@ -254,7 +254,8 @@ static LoaderStatus loader_start_external_app(
|
|||||||
Storage* storage,
|
Storage* storage,
|
||||||
const char* path,
|
const char* path,
|
||||||
const char* args,
|
const char* args,
|
||||||
FuriString* error_message) {
|
FuriString* error_message,
|
||||||
|
bool ignore_mismatch) {
|
||||||
LoaderStatus status = loader_make_success_status(error_message);
|
LoaderStatus status = loader_make_success_status(error_message);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -266,11 +267,39 @@ static LoaderStatus loader_start_external_app(
|
|||||||
FlipperApplicationPreloadStatus preload_res =
|
FlipperApplicationPreloadStatus preload_res =
|
||||||
flipper_application_preload(loader->app.fap, path);
|
flipper_application_preload(loader->app.fap, path);
|
||||||
if(preload_res != FlipperApplicationPreloadStatusSuccess) {
|
if(preload_res != FlipperApplicationPreloadStatusSuccess) {
|
||||||
|
if(preload_res == FlipperApplicationPreloadStatusApiMismatch) {
|
||||||
|
if(!ignore_mismatch) {
|
||||||
|
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
||||||
|
DialogMessage* message = dialog_message_alloc();
|
||||||
|
dialog_message_set_header(
|
||||||
|
message, "API Mismatch", 64, 0, AlignCenter, AlignTop);
|
||||||
|
dialog_message_set_buttons(message, "Cancel", NULL, "Continue");
|
||||||
|
dialog_message_set_text(
|
||||||
|
message,
|
||||||
|
"This app might not\nwork correctly\nContinue anyways?",
|
||||||
|
64,
|
||||||
|
32,
|
||||||
|
AlignCenter,
|
||||||
|
AlignCenter);
|
||||||
|
if(dialog_message_show(dialogs, message) == DialogMessageButtonRight) {
|
||||||
|
status = loader_make_status_error(
|
||||||
|
LoaderStatusErrorApiMismatch, error_message, "API Mismatch");
|
||||||
|
}
|
||||||
|
dialog_message_free(message);
|
||||||
|
furi_record_close(RECORD_DIALOGS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
const char* err_msg = flipper_application_preload_status_to_string(preload_res);
|
const char* err_msg = flipper_application_preload_status_to_string(preload_res);
|
||||||
status = loader_make_status_error(
|
status = loader_make_status_error(
|
||||||
LoaderStatusErrorInternal, error_message, "Preload failed %s: %s", path, err_msg);
|
LoaderStatusErrorInternal,
|
||||||
|
error_message,
|
||||||
|
"Preload failed %s: %s",
|
||||||
|
path,
|
||||||
|
err_msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FURI_LOG_I(TAG, "Mapping");
|
FURI_LOG_I(TAG, "Mapping");
|
||||||
FlipperApplicationLoadStatus load_status =
|
FlipperApplicationLoadStatus load_status =
|
||||||
@ -383,7 +412,12 @@ static LoaderStatus loader_do_start_by_name(
|
|||||||
{
|
{
|
||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
if(storage_file_exists(storage, name)) {
|
if(storage_file_exists(storage, name)) {
|
||||||
status = loader_start_external_app(loader, storage, name, args, error_message);
|
status =
|
||||||
|
loader_start_external_app(loader, storage, name, args, error_message, false);
|
||||||
|
if(status == LoaderStatusErrorApiMismatch) {
|
||||||
|
status = loader_start_external_app(
|
||||||
|
loader, storage, name, args, error_message, true);
|
||||||
|
}
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ typedef enum {
|
|||||||
LoaderStatusErrorAppStarted,
|
LoaderStatusErrorAppStarted,
|
||||||
LoaderStatusErrorUnknownApp,
|
LoaderStatusErrorUnknownApp,
|
||||||
LoaderStatusErrorInternal,
|
LoaderStatusErrorInternal,
|
||||||
|
LoaderStatusErrorApiMismatch,
|
||||||
} LoaderStatus;
|
} LoaderStatus;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
Loading…
Reference in New Issue
Block a user