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
|
||||
void FP_Scene_Callback_MainMenu(void* context, uint32_t index) {
|
||||
void FP_Scene_Callback_Default(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_Overview(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_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) {
|
||||
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, 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) {
|
||||
// Setting context
|
||||
|
@ -112,28 +78,28 @@ void FP_Scene_Enter_MainMenu(void* context) {
|
|||
app->submenu,
|
||||
"View Passwords",
|
||||
FP_Scene_MainMenu_Event_View,
|
||||
FP_Scene_Callback_MainMenu,
|
||||
FP_Scene_Callback_Default,
|
||||
app
|
||||
);
|
||||
submenu_add_item(
|
||||
app->submenu,
|
||||
"Create Password",
|
||||
FP_Scene_MainMenu_Event_Create,
|
||||
FP_Scene_Callback_MainMenu,
|
||||
FP_Scene_Callback_Default,
|
||||
app
|
||||
);
|
||||
submenu_add_item(
|
||||
app->submenu,
|
||||
"Archive Actions",
|
||||
FP_Scene_MainMenu_Event_Archive,
|
||||
FP_Scene_Callback_MainMenu,
|
||||
FP_Scene_Callback_Default,
|
||||
app
|
||||
);
|
||||
submenu_add_item(
|
||||
app->submenu,
|
||||
"About",
|
||||
FP_Scene_MainMenu_Event_About,
|
||||
FP_Scene_Callback_MainMenu,
|
||||
FP_Scene_Callback_Default,
|
||||
app
|
||||
);
|
||||
|
||||
|
@ -153,7 +119,7 @@ void FP_Scene_Enter_Overview(void* context) {
|
|||
app->submenu,
|
||||
app->manager->names[i],
|
||||
i,
|
||||
FP_Scene_Callback_Overview,
|
||||
FP_Scene_Callback_Default,
|
||||
app
|
||||
);
|
||||
}
|
||||
|
@ -173,21 +139,21 @@ void FP_Scene_Enter_View(void* context) {
|
|||
app->submenu,
|
||||
"View Username",
|
||||
FP_Scene_View_Event_Username,
|
||||
FP_Scene_Callback_View,
|
||||
FP_Scene_Callback_Default,
|
||||
app
|
||||
);
|
||||
submenu_add_item(
|
||||
app->submenu,
|
||||
"View Password",
|
||||
FP_Scene_View_Event_Password,
|
||||
FP_Scene_Callback_View,
|
||||
FP_Scene_Callback_Default,
|
||||
app
|
||||
);
|
||||
submenu_add_item(
|
||||
app->submenu,
|
||||
"BadUSB",
|
||||
FP_Scene_View_Event_BadUSB,
|
||||
FP_Scene_Callback_View,
|
||||
FP_Scene_Callback_Default,
|
||||
app
|
||||
);
|
||||
|
||||
|
@ -249,7 +215,7 @@ void FP_Scene_Enter_Send(void* context) {
|
|||
);
|
||||
|
||||
// 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);
|
||||
|
||||
// Send view to Flipper
|
||||
|
@ -295,7 +261,7 @@ void FP_Scene_Enter_Create(void* context) {
|
|||
// Callbacks
|
||||
variable_item_list_set_enter_callback(
|
||||
app->varitemlist,
|
||||
FP_Scene_Callback_Create,
|
||||
FP_Scene_Callback_Default,
|
||||
app
|
||||
);
|
||||
|
||||
|
@ -303,27 +269,13 @@ void FP_Scene_Enter_Create(void* context) {
|
|||
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
|
||||
FP_App* app = context;
|
||||
|
||||
// Reset menu
|
||||
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) {
|
||||
// Setting context
|
||||
FP_App* app = context;
|
||||
|
@ -334,20 +286,6 @@ void FP_Scene_Exit_Cred(void* context) {
|
|||
// Reset menu
|
||||
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) {
|
||||
// Setting context
|
||||
|
@ -540,12 +478,12 @@ bool (*const FP_Scene_Event_Handlers[])(void*, SceneManagerEvent) = {
|
|||
FP_Scene_Event_Create
|
||||
};
|
||||
void (*const FP_Scene_Exit_Handlers[])(void*) = {
|
||||
FP_Scene_Exit_MainMenu,
|
||||
FP_Scene_Exit_Overview,
|
||||
FP_Scene_Exit_View,
|
||||
FP_Scene_Exit_Default,
|
||||
FP_Scene_Exit_Default,
|
||||
FP_Scene_Exit_Default,
|
||||
FP_Scene_Exit_Cred,
|
||||
FP_Scene_Exit_Send,
|
||||
FP_Scene_Exit_Create
|
||||
FP_Scene_Exit_Default,
|
||||
FP_Scene_Exit_Default
|
||||
};
|
||||
|
||||
/* Event Handlers */
|
||||
|
|
Loading…
Reference in a new issue