Skip to content

Commit

Permalink
Fix "reset menu" still importing from xfw app list
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Willy-JL committed Mar 21, 2024
1 parent 2f7dfe4 commit 4719460
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4719460

Please sign in to comment.