flipbip_scene_scene_1.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 of scenes
  15. app->input_state = FlipBipTextInputMnemonic;
  16. text_input_set_header_text(app->text_input, "Enter mnemonic phrase");
  17. view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdTextInput);
  18. } else {
  19. // handle all other modes, these actually use this scene's logic
  20. flipbip_scene_1_set_callback(app->flipbip_scene_1, flipbip_scene_1_callback, app);
  21. view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdScene1);
  22. }
  23. }
  24. bool flipbip_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
  25. FlipBip* app = context;
  26. bool consumed = false;
  27. if(event.type == SceneManagerEventTypeCustom) {
  28. switch(event.event) {
  29. // case FlipBipCustomEventScene1Left:
  30. // case FlipBipCustomEventScene1Right:
  31. // break;
  32. // case FlipBipCustomEventScene1Up:
  33. // case FlipBipCustomEventScene1Down:
  34. // break;
  35. case FlipBipCustomEventScene1Back:
  36. //notification_message(app->notification, &sequence_reset_red);
  37. //notification_message(app->notification, &sequence_reset_green);
  38. //notification_message(app->notification, &sequence_reset_blue);
  39. if(!scene_manager_search_and_switch_to_previous_scene(
  40. app->scene_manager, FlipBipSceneMenu)) {
  41. scene_manager_stop(app->scene_manager);
  42. view_dispatcher_stop(app->view_dispatcher);
  43. }
  44. consumed = true;
  45. break;
  46. }
  47. }
  48. return consumed;
  49. }
  50. void flipbip_scene_scene_1_on_exit(void* context) {
  51. FlipBip* app = context;
  52. UNUSED(app);
  53. }