Skip to content

Commit

Permalink
Reformatted event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
squee72564 committed Dec 31, 2023
1 parent 232b703 commit df2a0ad
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions scenes/menu_scene.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,28 @@ bool minesweeper_scene_menu_on_event(void* context, SceneManagerEvent event) {
bool consumed = false;

if (event.type == SceneManagerEventTypeCustom) {
if (event.event == DialogExResultLeft) {

// not sure if this is needed but saw it in a stock f0 firmware app
// checks if no previous scene and quits
if (!scene_manager_previous_scene(app->scene_manager)) {
switch (event.event) {

case DialogExResultLeft :
//if (!scene_manager_previous_scene(app->scene_manager)) { // Exit in the case of no prev scene
// scene_manager_stop(app->scene_manager);
// view_dispatcher_stop(app->view_dispatcher);
// consumed = true;
//} else {
// // We are dereferencing a null ptr when this happens
consumed = scene_manager_previous_scene(app->scene_manager);
//}
break;

case DialogExResultRight :
scene_manager_stop(app->scene_manager);
view_dispatcher_stop(app->view_dispatcher);
}
consumed = true;
break;

} else if (event.event == DialogExResultRight) {
scene_manager_stop(app->scene_manager);
view_dispatcher_stop(app->view_dispatcher);
default :
break;
}
consumed = true;

}

return consumed;
Expand Down

0 comments on commit df2a0ad

Please sign in to comment.