71 lines
No EOL
1.6 KiB
C
71 lines
No EOL
1.6 KiB
C
// Header
|
|
#include "cred.h"
|
|
|
|
// Functions
|
|
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_Enter_Cred(void* context) {
|
|
// Set context
|
|
FP_App* app = context;
|
|
|
|
// Reset view
|
|
text_box_reset(app->textbox);
|
|
|
|
// Setting text
|
|
switch (app->selection) {
|
|
case 0: // Username
|
|
text_box_set_text(
|
|
app->textbox,
|
|
app->manager->current->user
|
|
);
|
|
break;
|
|
case 1: // Password
|
|
text_box_set_text(
|
|
app->textbox,
|
|
app->manager->current->phrase
|
|
);
|
|
break;
|
|
}
|
|
|
|
// Send view to Flipper
|
|
view_dispatcher_switch_to_view(app->view_dispatcher, FP_View_TextBox);
|
|
}
|
|
void FP_Scene_Exit_Cred(void* context) {
|
|
// Setting context
|
|
FP_App* app = context;
|
|
|
|
// Reset menu
|
|
text_box_reset(app->dialog);
|
|
}
|
|
bool FP_Scene_Event_Cred(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;
|
|
|
|
// Debug log about what we pressed
|
|
FURI_LOG_D(TAG, "Pressed %li", event.event);
|
|
|
|
UNUSED(app);
|
|
|
|
// What to do?
|
|
switch (event.event) {
|
|
default:
|
|
break;
|
|
}
|
|
} else {
|
|
consumed = false;
|
|
}
|
|
|
|
// Return result
|
|
return consumed;
|
|
} |