59 lines
No EOL
1.3 KiB
C
59 lines
No EOL
1.3 KiB
C
// Header
|
|
#include "auth.h"
|
|
|
|
// Constants
|
|
#define KEYBOARD_STR_LEN 64
|
|
|
|
// Functions
|
|
void FP_Scene_Callback_Auth(void* context) {
|
|
// Setting context
|
|
FP_App* app = context;
|
|
|
|
// Loading manager with key
|
|
app->manager = manager_init(app->keyboard);
|
|
|
|
// Freeing key
|
|
free(app->keyboard);
|
|
|
|
// Going to main menu!
|
|
scene_manager_next_scene(app->scene_manager, FP_Scene_MainMenu);
|
|
}
|
|
void FP_Scene_Enter_Auth(void* context) {
|
|
// Set Context
|
|
FP_App* app = context;
|
|
|
|
// Reset view
|
|
text_input_reset(app->textinput);
|
|
|
|
// Creating keyboard string
|
|
app->keyboard = malloc(sizeof(char) * KEYBOARD_STR_LEN);
|
|
|
|
// Setting stuff
|
|
text_input_set_header_text(
|
|
app->textinput,
|
|
"Enter Passphrase"
|
|
);
|
|
text_input_set_result_callback(
|
|
app->textinput,
|
|
FP_Scene_Callback_Auth,
|
|
app,
|
|
app->keyboard,
|
|
KEYBOARD_STR_LEN,
|
|
true
|
|
);
|
|
|
|
// Send view to Flipper
|
|
view_dispatcher_switch_to_view(app->view_dispatcher, FP_View_TextInput);
|
|
}
|
|
void FP_Scene_Exit_Auth(void* context) {
|
|
// Setting context
|
|
FP_App* app = context;
|
|
|
|
// Reset menu
|
|
submenu_reset(app->submenu);
|
|
}
|
|
bool FP_Scene_Event_Auth(void* context, SceneManagerEvent event) {
|
|
// Return result
|
|
UNUSED(context);
|
|
return event.type == SceneManagerEventTypeCustom;
|
|
} |