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:
MX 2023-06-29 05:38:44 +03:00
parent 5e2d01f159
commit 380734f804
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
2 changed files with 41 additions and 6 deletions

View File

@ -254,7 +254,8 @@ static LoaderStatus loader_start_external_app(
Storage* storage,
const char* path,
const char* args,
FuriString* error_message) {
FuriString* error_message,
bool ignore_mismatch) {
LoaderStatus status = loader_make_success_status(error_message);
do {
@ -266,11 +267,39 @@ static LoaderStatus loader_start_external_app(
FlipperApplicationPreloadStatus preload_res =
flipper_application_preload(loader->app.fap, path);
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);
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;
}
}
FURI_LOG_I(TAG, "Mapping");
FlipperApplicationLoadStatus load_status =
@ -383,7 +412,12 @@ static LoaderStatus loader_do_start_by_name(
{
Storage* storage = furi_record_open(RECORD_STORAGE);
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);
break;
}

View File

@ -15,6 +15,7 @@ typedef enum {
LoaderStatusErrorAppStarted,
LoaderStatusErrorUnknownApp,
LoaderStatusErrorInternal,
LoaderStatusErrorApiMismatch,
} LoaderStatus;
typedef enum {