80 lines
No EOL
1.8 KiB
C
80 lines
No EOL
1.8 KiB
C
// Header
|
|
#include "send.h"
|
|
|
|
// Functions
|
|
void FP_Scene_Callback_Send(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_Enter_Send(void* context) {
|
|
// Setting context
|
|
FP_App* app = context;
|
|
|
|
// Reset view
|
|
dialog_ex_reset(app->dialog);
|
|
|
|
// Adding dialog content
|
|
dialog_ex_set_header(
|
|
app->dialog,
|
|
"Send via BadUSB",
|
|
0,0,
|
|
AlignLeft,
|
|
AlignTop
|
|
);
|
|
dialog_ex_set_text(
|
|
app->dialog,
|
|
"This will type out either the Username or Password using BadUSB",
|
|
5,15,
|
|
AlignLeft,
|
|
AlignTop
|
|
);
|
|
dialog_ex_set_left_button_text(
|
|
app->dialog,
|
|
"Username"
|
|
);
|
|
dialog_ex_set_right_button_text(
|
|
app->dialog,
|
|
"Password"
|
|
);
|
|
|
|
// Setting context and callback
|
|
dialog_ex_set_result_callback(app->dialog, FP_Scene_Callback_Send);
|
|
dialog_ex_set_context(app->dialog, app);
|
|
|
|
// Send view to Flipper
|
|
view_dispatcher_switch_to_view(app->view_dispatcher, FP_View_Dialog);
|
|
}
|
|
void FP_Scene_Exit_Send(void* context) {
|
|
// Setting context
|
|
FP_App* app = context;
|
|
|
|
// Reset menu
|
|
submenu_reset(app->submenu);
|
|
}
|
|
bool FP_Scene_Event_Send(void* context, SceneManagerEvent event) {
|
|
// Setting context
|
|
FP_App* app = context;
|
|
bool consumed = false;
|
|
|
|
// Switching based on event
|
|
if (event.type == SceneManagerEventTypeCustom) {
|
|
// We consumed it
|
|
consumed = true;
|
|
|
|
UNUSED(app);
|
|
|
|
// What to do?
|
|
switch (event.event) {
|
|
default:
|
|
break;
|
|
}
|
|
} else {
|
|
consumed = false;
|
|
}
|
|
|
|
// Return result
|
|
return consumed;
|
|
} |