diff --git a/project/ui/scenes/about.c b/project/ui/scenes/about.c new file mode 100644 index 0000000..000e6b0 --- /dev/null +++ b/project/ui/scenes/about.c @@ -0,0 +1,61 @@ +// Header +#include "about.h" + +// Functions +void FP_Scene_Callback_About(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_About(void* context){ + // Setting context + FP_App* app = context; + + // Reset view + text_box_reset(app->textbox); + + // Setting some content + text_box_set_text( + app->textbox, + "FlippyPass - A Password Manager for the Flipper-Zero\nA robust password manager for the Flipper Zero designed in C" + ); + + // Sending view to Flipper + view_dispatcher_switch_to_view(app->view_dispatcher, FP_View_TextBox); +} +void FP_Scene_Exit_About(void* context){ + // Setting context + FP_App* app = context; + + // Reset menu + text_box_reset(app->textbox); +} +bool FP_Scene_Event_About(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; +} \ No newline at end of file diff --git a/project/ui/scenes/about.h b/project/ui/scenes/about.h new file mode 100644 index 0000000..bae84b2 --- /dev/null +++ b/project/ui/scenes/about.h @@ -0,0 +1,14 @@ +// Define once +#ifndef H_S_ABOUT +#define H_S_ABOUT + +// Libraries +#include "../app.h" + +// Functions +void FP_Scene_Callback_About(void* context, uint32_t index); +void FP_Scene_Enter_About(void* context); +void FP_Scene_Exit_About(void* context); +bool FP_Scene_Event_About(void* context, SceneManagerEvent event); + +#endif \ No newline at end of file diff --git a/project/ui/scenes/cred.c b/project/ui/scenes/cred.c index 9448aa8..a5c9361 100644 --- a/project/ui/scenes/cred.c +++ b/project/ui/scenes/cred.c @@ -40,7 +40,7 @@ void FP_Scene_Exit_Cred(void* context) { FP_App* app = context; // Reset menu - dialog_ex_reset(app->dialog); + text_box_reset(app->dialog); } bool FP_Scene_Event_Cred(void* context, SceneManagerEvent event) { // Setting context diff --git a/project/ui/ui.c b/project/ui/ui.c index 2cc47a5..dfc59cd 100644 --- a/project/ui/ui.c +++ b/project/ui/ui.c @@ -10,6 +10,7 @@ #include "scenes/send.h" #include "scenes/create.h" #include "scenes/type.h" +#include "scenes/about.h" // Handlers void (*const FP_Scene_Enter_Handlers[])(void*) = { @@ -20,7 +21,8 @@ void (*const FP_Scene_Enter_Handlers[])(void*) = { FP_Scene_Enter_Cred, FP_Scene_Enter_Send, FP_Scene_Enter_Create, - FP_Scene_Enter_Type + FP_Scene_Enter_Type, + FP_Scene_Enter_About }; bool (*const FP_Scene_Event_Handlers[])(void*, SceneManagerEvent) = { FP_Scene_Event_Auth, @@ -30,7 +32,8 @@ bool (*const FP_Scene_Event_Handlers[])(void*, SceneManagerEvent) = { FP_Scene_Event_Cred, FP_Scene_Event_Send, FP_Scene_Event_Create, - FP_Scene_Event_Type + FP_Scene_Event_Type, + FP_Scene_Event_About }; void (*const FP_Scene_Exit_Handlers[])(void*) = { FP_Scene_Exit_Auth, @@ -40,7 +43,8 @@ void (*const FP_Scene_Exit_Handlers[])(void*) = { FP_Scene_Exit_Cred, FP_Scene_Exit_Send, FP_Scene_Exit_Create, - FP_Scene_Exit_Type + FP_Scene_Exit_Type, + FP_Scene_Exit_About }; // Main Handler