Skip to content

Commit

Permalink
Update settings_ui.c
Browse files Browse the repository at this point in the history
  • Loading branch information
jaylikesbunda committed Dec 5, 2024
1 parent cc8953b commit 32bf717
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions src/settings_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,6 @@ bool settings_custom_event_callback(void* context, uint32_t event_id) {
if(!app_state) return false;

switch(event_id) {
case SETTING_SHOW_INFO:
show_app_info(app_state);
return true;

case SETTING_CLEAR_LOGS:
show_confirmation_dialog_ex(
app_state,
Expand Down Expand Up @@ -503,9 +499,41 @@ bool settings_custom_event_callback(void* context, uint32_t event_id) {
nvs_clear_cancelled_callback);
return true;

case SETTING_SHOW_INFO: {
// Create a new context for the confirmation dialog
SettingsConfirmContext* confirm_ctx = malloc(sizeof(SettingsConfirmContext));
if(!confirm_ctx) return false;
confirm_ctx->state = app_state;

const char* info_text =
"Created by: Spooky\n"
"Updated by: Jay Candel\n"
"Built with <3";

confirmation_view_set_header(app_state->confirmation_view, "Ghost ESP v1.1.8");
confirmation_view_set_text(app_state->confirmation_view, info_text);

// Save current view before switching
app_state->previous_view = app_state->current_view;

confirmation_view_set_ok_callback(
app_state->confirmation_view,
app_info_ok_callback,
confirm_ctx);
confirmation_view_set_cancel_callback(
app_state->confirmation_view,
app_info_cancel_callback,
confirm_ctx);

view_dispatcher_switch_to_view(app_state->view_dispatcher, 7);
app_state->current_view = 7;
break;
}

default:
return false;
}
return false;
}

// 6675636B796F7564656B69

0 comments on commit 32bf717

Please sign in to comment.