flipbip_scene_scene_1.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "../flipbip.h"
  2. #include "../helpers/flipbip_custom_event.h"
  3. #include "../views/flipbip_scene_1.h"
  4. void flipbip_scene_1_callback(FlipBipCustomEvent event, void* context) {
  5. furi_assert(context);
  6. FlipBip* app = context;
  7. view_dispatcher_send_custom_event(app->view_dispatcher, event);
  8. }
  9. void flipbip_scene_scene_1_on_enter(void* context) {
  10. furi_assert(context);
  11. FlipBip* app = context;
  12. if(app->import_from_mnemonic == 1) {
  13. // handle mnemonic seed import mode with text input, this only
  14. // uses this scene to have a correct stack os scenes
  15. text_input_set_header_text(app->text_input, "Enter mnemonic phrase");
  16. view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdTextInput);
  17. } else {
  18. // handle all other modes, these actually use this scene's logic
  19. flipbip_scene_1_set_callback(app->flipbip_scene_1, flipbip_scene_1_callback, app);
  20. view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdScene1);
  21. }
  22. }
  23. bool flipbip_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
  24. FlipBip* app = context;
  25. bool consumed = false;
  26. if(event.type == SceneManagerEventTypeCustom) {
  27. switch(event.event) {
  28. // case FlipBipCustomEventScene1Left:
  29. // case FlipBipCustomEventScene1Right:
  30. // break;
  31. // case FlipBipCustomEventScene1Up:
  32. // case FlipBipCustomEventScene1Down:
  33. // break;
  34. case FlipBipCustomEventScene1Back:
  35. //notification_message(app->notification, &sequence_reset_red);
  36. //notification_message(app->notification, &sequence_reset_green);
  37. //notification_message(app->notification, &sequence_reset_blue);
  38. if(!scene_manager_search_and_switch_to_previous_scene(
  39. app->scene_manager, FlipBipSceneMenu)) {
  40. scene_manager_stop(app->scene_manager);
  41. view_dispatcher_stop(app->view_dispatcher);
  42. }
  43. consumed = true;
  44. break;
  45. }
  46. }
  47. return consumed;
  48. }
  49. void flipbip_scene_scene_1_on_exit(void* context) {
  50. FlipBip* app = context;
  51. UNUSED(app);
  52. }