Skip to content

Commit

Permalink
Removed exit view confirmation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
hryamzik committed Nov 18, 2023
1 parent 483d381 commit b654b5a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
33 changes: 2 additions & 31 deletions base_pack/hid_app/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,11 @@ static void bt_hid_connection_status_changed_callback(BtStatus status, void* con
hid_tikshorts_set_connected_status(hid->hid_tikshorts, connected);
}

static void hid_dialog_callback(DialogExResult result, void* context) {
furi_assert(context);
Hid* app = context;
if(result == DialogExResultLeft) {
view_dispatcher_stop(app->view_dispatcher);
} else if(result == DialogExResultRight) {
view_dispatcher_switch_to_view(app->view_dispatcher, app->view_id); // Show last view
} else if(result == DialogExResultCenter) {
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewSubmenu);
}
}

static uint32_t hid_menu_view(void* context) {
UNUSED(context);
return HidViewSubmenu;
}

static uint32_t hid_exit_confirm_view(void* context) {
UNUSED(context);
return HidViewExitConfirm;
}

static uint32_t hid_exit(void* context) {
UNUSED(context);
return VIEW_NONE;
Expand Down Expand Up @@ -180,16 +163,6 @@ Hid* hid_alloc(HidTransport transport) {
Hid* hid_app_alloc_view(void* context) {
furi_assert(context);
Hid* app = context;
// Dialog view
app->dialog = dialog_ex_alloc();
dialog_ex_set_result_callback(app->dialog, hid_dialog_callback);
dialog_ex_set_context(app->dialog, app);
dialog_ex_set_left_button_text(app->dialog, "Exit");
dialog_ex_set_right_button_text(app->dialog, "Stay");
dialog_ex_set_center_button_text(app->dialog, "Menu");
dialog_ex_set_header(app->dialog, "Close Current App?", 16, 12, AlignLeft, AlignTop);
view_dispatcher_add_view(
app->view_dispatcher, HidViewExitConfirm, dialog_ex_get_view(app->dialog));

// Keynote view
app->hid_keynote = hid_keynote_alloc(app);
Expand Down Expand Up @@ -223,13 +196,13 @@ Hid* hid_app_alloc_view(void* context) {

// TikTok / YT Shorts view
app->hid_tikshorts = hid_tikshorts_alloc(app);
view_set_previous_callback(hid_tikshorts_get_view(app->hid_tikshorts), hid_exit_confirm_view);
view_set_previous_callback(hid_tikshorts_get_view(app->hid_tikshorts), hid_menu_view);
view_dispatcher_add_view(
app->view_dispatcher, BtHidViewTikShorts, hid_tikshorts_get_view(app->hid_tikshorts));

// Mouse view
app->hid_mouse = hid_mouse_alloc(app);
view_set_previous_callback(hid_mouse_get_view(app->hid_mouse), hid_exit_confirm_view);
view_set_previous_callback(hid_mouse_get_view(app->hid_mouse), hid_menu_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewMouse, hid_mouse_get_view(app->hid_mouse));

Expand Down Expand Up @@ -271,8 +244,6 @@ void hid_free(Hid* app) {
// Free views
view_dispatcher_remove_view(app->view_dispatcher, HidViewSubmenu);
submenu_free(app->device_type_submenu);
view_dispatcher_remove_view(app->view_dispatcher, HidViewExitConfirm);
dialog_ex_free(app->dialog);
view_dispatcher_remove_view(app->view_dispatcher, HidViewKeynote);
hid_keynote_free(app->hid_keynote);
view_dispatcher_remove_view(app->view_dispatcher, HidViewKeyboard);
Expand Down
1 change: 0 additions & 1 deletion base_pack/hid_app/views.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ typedef enum {
HidViewMouseJiggler,
BtHidViewTikShorts,
HidViewPtt,
HidViewExitConfirm,
} HidView;

0 comments on commit b654b5a

Please sign in to comment.