mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-16 01:28:00 +00:00
0c1bcf144b
Co-authored-by: あく <alleteam@gmail.com>
50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
#include "../desktop_i.h"
|
|
|
|
#define SCENE_EXIT_EVENT (0U)
|
|
|
|
void desktop_scene_ok_callback(void* context) {
|
|
Desktop* app = context;
|
|
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EXIT_EVENT);
|
|
}
|
|
|
|
void desktop_scene_pinsetup_on_enter(void* context) {
|
|
Desktop* app = context;
|
|
CodeInput* code_input = app->code_input;
|
|
|
|
code_input_set_result_callback(
|
|
code_input,
|
|
desktop_scene_ok_callback,
|
|
NULL,
|
|
app,
|
|
app->settings.pincode.data,
|
|
&app->settings.pincode.length,
|
|
true);
|
|
|
|
view_dispatcher_switch_to_view(app->view_dispatcher, DesktopViewPinSetup);
|
|
}
|
|
|
|
bool desktop_scene_pinsetup_on_event(void* context, SceneManagerEvent event) {
|
|
Desktop* app = context;
|
|
bool consumed = false;
|
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
switch(event.event) {
|
|
case SCENE_EXIT_EVENT:
|
|
scene_manager_previous_scene(app->scene_manager);
|
|
consumed = true;
|
|
break;
|
|
|
|
default:
|
|
consumed = true;
|
|
break;
|
|
}
|
|
}
|
|
return consumed;
|
|
}
|
|
|
|
void desktop_scene_pinsetup_on_exit(void* context) {
|
|
Desktop* app = context;
|
|
SAVE_DESKTOP_SETTINGS(&app->settings);
|
|
code_input_set_result_callback(app->code_input, NULL, NULL, NULL, NULL, NULL, 0);
|
|
code_input_set_header_text(app->code_input, "");
|
|
}
|