From 4719460e272edbf6af362fcebca59b63e69a4fb8 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Thu, 21 Mar 2024 04:43:53 +0000 Subject: [PATCH] Fix "reset menu" still importing from xfw app list Previously, it deleted the file then rebooted This caused a new, default list to be generated However, since the xfw list file is kept, it will migrate it Instead, generate on the spot, rather than deleting and rebooting --- ...entum_app_scene_interface_mainmenu_reset.c | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/applications/main/momentum_app/scenes/momentum_app_scene_interface_mainmenu_reset.c b/applications/main/momentum_app/scenes/momentum_app_scene_interface_mainmenu_reset.c index 8c7cef91fc..54ddde2964 100644 --- a/applications/main/momentum_app/scenes/momentum_app_scene_interface_mainmenu_reset.c +++ b/applications/main/momentum_app/scenes/momentum_app_scene_interface_mainmenu_reset.c @@ -31,11 +31,26 @@ bool momentum_app_scene_interface_mainmenu_reset_on_event(void* context, SceneMa if(event.type == SceneManagerEventTypeCustom) { switch(event.event) { case DialogExResultRight: - storage_common_remove(furi_record_open(RECORD_STORAGE), MAINMENU_APPS_PATH); + bool reset = false; + Stream* stream = file_stream_alloc(furi_record_open(RECORD_STORAGE)); + if(file_stream_open(stream, MAINMENU_APPS_PATH, FSAM_WRITE, FSOM_CREATE_ALWAYS)) { + stream_write_format(stream, "MenuAppList Version %u\n", 1); + for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) { + stream_write_format(stream, "%s\n", FLIPPER_APPS[i].name); + } + for(size_t i = 0; i < FLIPPER_EXTERNAL_APPS_COUNT - 1; i++) { + stream_write_format(stream, "%s\n", FLIPPER_EXTERNAL_APPS[i].name); + } + reset = true; + } + file_stream_close(stream); + stream_free(stream); furi_record_close(RECORD_STORAGE); - app->save_mainmenu_apps = false; - app->require_reboot = true; - momentum_app_apply(app); + if(reset) { + app->save_mainmenu_apps = false; + app->require_reboot = true; + momentum_app_apply(app); + } break; case DialogExResultLeft: scene_manager_previous_scene(app->scene_manager);