Code Cleanup
This commit is contained in:
parent
24f365fec0
commit
b8e9067a8c
1 changed files with 18 additions and 80 deletions
|
@ -50,55 +50,21 @@ const FP_Variable_Item fp_scene_create_options[4] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Page functions
|
// Page functions
|
||||||
void FP_Scene_Callback_MainMenu(void* context, uint32_t index) {
|
void FP_Scene_Callback_Default(void* context, uint32_t index) {
|
||||||
// Setting context
|
// Setting context
|
||||||
FP_App* app = context;
|
FP_App* app = context;
|
||||||
|
|
||||||
// Sending it to the scene manager
|
// Sending it to the scene manager
|
||||||
scene_manager_handle_custom_event(app->scene_manager, index);
|
scene_manager_handle_custom_event(app->scene_manager, index);
|
||||||
}
|
}
|
||||||
void FP_Scene_Callback_Overview(void* context, uint32_t index) {
|
void FP_Scene_Callback_Dialog(DialogExResult result, void* context) {
|
||||||
// Setting context
|
|
||||||
FP_App* app = context;
|
|
||||||
|
|
||||||
// Sending it to the scene manager
|
|
||||||
scene_manager_handle_custom_event(app->scene_manager, index);
|
|
||||||
}
|
|
||||||
void FP_Scene_Callback_View(void* context, uint32_t index) {
|
|
||||||
// Setting context
|
|
||||||
FP_App* app = context;
|
|
||||||
|
|
||||||
// Sending it to the scene manager
|
|
||||||
scene_manager_handle_custom_event(app->scene_manager, index);
|
|
||||||
}
|
|
||||||
void FP_Scene_Callback_Cred(void* context, uint32_t index) {
|
|
||||||
// Setting context
|
|
||||||
FP_App* app = context;
|
|
||||||
|
|
||||||
// Sending it to the scene manager
|
|
||||||
scene_manager_handle_custom_event(app->scene_manager, index);
|
|
||||||
}
|
|
||||||
void FP_Scene_Callback_Send(DialogExResult result, void* context) {
|
|
||||||
// Setting context
|
// Setting context
|
||||||
FP_App* app = context;
|
FP_App* app = context;
|
||||||
|
|
||||||
// Sending it to the scene manager
|
// Sending it to the scene manager
|
||||||
scene_manager_handle_custom_event(app->scene_manager, result);
|
scene_manager_handle_custom_event(app->scene_manager, result);
|
||||||
}
|
}
|
||||||
void FP_Scene_Callback_Create(void* context, uint32_t index) {
|
|
||||||
// Setting context
|
|
||||||
FP_App* app = context;
|
|
||||||
|
|
||||||
// Sending it to the scene manager
|
|
||||||
scene_manager_handle_custom_event(app->scene_manager, index);
|
|
||||||
}
|
|
||||||
void FP_Scene_Callback_Create_Change(void* context, uint32_t index) {
|
|
||||||
// Setting context
|
|
||||||
FP_App* app = context;
|
|
||||||
|
|
||||||
// Sending it to the scene manager
|
|
||||||
scene_manager_handle_custom_event(app->scene_manager, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FP_Scene_Enter_MainMenu(void* context) {
|
void FP_Scene_Enter_MainMenu(void* context) {
|
||||||
// Setting context
|
// Setting context
|
||||||
|
@ -112,28 +78,28 @@ void FP_Scene_Enter_MainMenu(void* context) {
|
||||||
app->submenu,
|
app->submenu,
|
||||||
"View Passwords",
|
"View Passwords",
|
||||||
FP_Scene_MainMenu_Event_View,
|
FP_Scene_MainMenu_Event_View,
|
||||||
FP_Scene_Callback_MainMenu,
|
FP_Scene_Callback_Default,
|
||||||
app
|
app
|
||||||
);
|
);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
app->submenu,
|
app->submenu,
|
||||||
"Create Password",
|
"Create Password",
|
||||||
FP_Scene_MainMenu_Event_Create,
|
FP_Scene_MainMenu_Event_Create,
|
||||||
FP_Scene_Callback_MainMenu,
|
FP_Scene_Callback_Default,
|
||||||
app
|
app
|
||||||
);
|
);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
app->submenu,
|
app->submenu,
|
||||||
"Archive Actions",
|
"Archive Actions",
|
||||||
FP_Scene_MainMenu_Event_Archive,
|
FP_Scene_MainMenu_Event_Archive,
|
||||||
FP_Scene_Callback_MainMenu,
|
FP_Scene_Callback_Default,
|
||||||
app
|
app
|
||||||
);
|
);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
app->submenu,
|
app->submenu,
|
||||||
"About",
|
"About",
|
||||||
FP_Scene_MainMenu_Event_About,
|
FP_Scene_MainMenu_Event_About,
|
||||||
FP_Scene_Callback_MainMenu,
|
FP_Scene_Callback_Default,
|
||||||
app
|
app
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -153,7 +119,7 @@ void FP_Scene_Enter_Overview(void* context) {
|
||||||
app->submenu,
|
app->submenu,
|
||||||
app->manager->names[i],
|
app->manager->names[i],
|
||||||
i,
|
i,
|
||||||
FP_Scene_Callback_Overview,
|
FP_Scene_Callback_Default,
|
||||||
app
|
app
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -173,21 +139,21 @@ void FP_Scene_Enter_View(void* context) {
|
||||||
app->submenu,
|
app->submenu,
|
||||||
"View Username",
|
"View Username",
|
||||||
FP_Scene_View_Event_Username,
|
FP_Scene_View_Event_Username,
|
||||||
FP_Scene_Callback_View,
|
FP_Scene_Callback_Default,
|
||||||
app
|
app
|
||||||
);
|
);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
app->submenu,
|
app->submenu,
|
||||||
"View Password",
|
"View Password",
|
||||||
FP_Scene_View_Event_Password,
|
FP_Scene_View_Event_Password,
|
||||||
FP_Scene_Callback_View,
|
FP_Scene_Callback_Default,
|
||||||
app
|
app
|
||||||
);
|
);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
app->submenu,
|
app->submenu,
|
||||||
"BadUSB",
|
"BadUSB",
|
||||||
FP_Scene_View_Event_BadUSB,
|
FP_Scene_View_Event_BadUSB,
|
||||||
FP_Scene_Callback_View,
|
FP_Scene_Callback_Default,
|
||||||
app
|
app
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -249,7 +215,7 @@ void FP_Scene_Enter_Send(void* context) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Setting context and callback
|
// Setting context and callback
|
||||||
dialog_ex_set_result_callback(app->dialog, FP_Scene_Callback_Send);
|
dialog_ex_set_result_callback(app->dialog, FP_Scene_Callback_Dialog);
|
||||||
dialog_ex_set_context(app->dialog, app);
|
dialog_ex_set_context(app->dialog, app);
|
||||||
|
|
||||||
// Send view to Flipper
|
// Send view to Flipper
|
||||||
|
@ -295,7 +261,7 @@ void FP_Scene_Enter_Create(void* context) {
|
||||||
// Callbacks
|
// Callbacks
|
||||||
variable_item_list_set_enter_callback(
|
variable_item_list_set_enter_callback(
|
||||||
app->varitemlist,
|
app->varitemlist,
|
||||||
FP_Scene_Callback_Create,
|
FP_Scene_Callback_Default,
|
||||||
app
|
app
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -303,27 +269,13 @@ void FP_Scene_Enter_Create(void* context) {
|
||||||
view_dispatcher_switch_to_view(app->view_dispatcher, FP_View_VariableItemList);
|
view_dispatcher_switch_to_view(app->view_dispatcher, FP_View_VariableItemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FP_Scene_Exit_MainMenu(void* context) {
|
void FP_Scene_Exit_Default(void* context) {
|
||||||
// Setting context
|
// Setting context
|
||||||
FP_App* app = context;
|
FP_App* app = context;
|
||||||
|
|
||||||
// Reset menu
|
// Reset menu
|
||||||
submenu_reset(app->submenu);
|
submenu_reset(app->submenu);
|
||||||
}
|
}
|
||||||
void FP_Scene_Exit_Overview(void* context) {
|
|
||||||
// Setting context
|
|
||||||
FP_App* app = context;
|
|
||||||
|
|
||||||
// Reset menu
|
|
||||||
submenu_reset(app->submenu);
|
|
||||||
}
|
|
||||||
void FP_Scene_Exit_View(void* context) {
|
|
||||||
// Setting context
|
|
||||||
FP_App* app = context;
|
|
||||||
|
|
||||||
// Reset menu
|
|
||||||
dialog_ex_reset(app->dialog);
|
|
||||||
}
|
|
||||||
void FP_Scene_Exit_Cred(void* context) {
|
void FP_Scene_Exit_Cred(void* context) {
|
||||||
// Setting context
|
// Setting context
|
||||||
FP_App* app = context;
|
FP_App* app = context;
|
||||||
|
@ -334,20 +286,6 @@ void FP_Scene_Exit_Cred(void* context) {
|
||||||
// Reset menu
|
// Reset menu
|
||||||
dialog_ex_reset(app->dialog);
|
dialog_ex_reset(app->dialog);
|
||||||
}
|
}
|
||||||
void FP_Scene_Exit_Send(void* context) {
|
|
||||||
// Setting context
|
|
||||||
FP_App* app = context;
|
|
||||||
|
|
||||||
// Reset menu
|
|
||||||
dialog_ex_reset(app->dialog);
|
|
||||||
}
|
|
||||||
void FP_Scene_Exit_Create(void* context) {
|
|
||||||
// Setting context
|
|
||||||
FP_App* app = context;
|
|
||||||
|
|
||||||
// Reset menu
|
|
||||||
dialog_ex_reset(app->dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FP_Scene_Event_MainMenu(void* context, SceneManagerEvent event) {
|
bool FP_Scene_Event_MainMenu(void* context, SceneManagerEvent event) {
|
||||||
// Setting context
|
// Setting context
|
||||||
|
@ -540,12 +478,12 @@ bool (*const FP_Scene_Event_Handlers[])(void*, SceneManagerEvent) = {
|
||||||
FP_Scene_Event_Create
|
FP_Scene_Event_Create
|
||||||
};
|
};
|
||||||
void (*const FP_Scene_Exit_Handlers[])(void*) = {
|
void (*const FP_Scene_Exit_Handlers[])(void*) = {
|
||||||
FP_Scene_Exit_MainMenu,
|
FP_Scene_Exit_Default,
|
||||||
FP_Scene_Exit_Overview,
|
FP_Scene_Exit_Default,
|
||||||
FP_Scene_Exit_View,
|
FP_Scene_Exit_Default,
|
||||||
FP_Scene_Exit_Cred,
|
FP_Scene_Exit_Cred,
|
||||||
FP_Scene_Exit_Send,
|
FP_Scene_Exit_Default,
|
||||||
FP_Scene_Exit_Create
|
FP_Scene_Exit_Default
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Event Handlers */
|
/* Event Handlers */
|
||||||
|
|
Loading…
Reference in a new issue