flipbip_scene_startscreen.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "../flipbip.h"
  2. #include "../helpers/flipbip_custom_event.h"
  3. #include "../views/flipbip_startscreen.h"
  4. void flipbip_scene_startscreen_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_startscreen_on_enter(void* context) {
  10. furi_assert(context);
  11. FlipBip* app = context;
  12. flipbip_startscreen_set_callback(app->flipbip_startscreen, flipbip_scene_startscreen_callback, app);
  13. view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdStartscreen);
  14. }
  15. bool flipbip_scene_startscreen_on_event(void* context, SceneManagerEvent event) {
  16. FlipBip* app = context;
  17. bool consumed = false;
  18. if(event.type == SceneManagerEventTypeCustom) {
  19. switch(event.event) {
  20. case FlipBipCustomEventStartscreenLeft:
  21. case FlipBipCustomEventStartscreenRight:
  22. break;
  23. case FlipBipCustomEventStartscreenUp:
  24. case FlipBipCustomEventStartscreenDown:
  25. break;
  26. case FlipBipCustomEventStartscreenOk:
  27. scene_manager_next_scene(app->scene_manager, FlipBipSceneMenu);
  28. consumed = true;
  29. break;
  30. case FlipBipCustomEventStartscreenBack:
  31. notification_message(app->notification, &sequence_reset_red);
  32. notification_message(app->notification, &sequence_reset_green);
  33. notification_message(app->notification, &sequence_reset_blue);
  34. if(!scene_manager_search_and_switch_to_previous_scene(
  35. app->scene_manager, FlipBipSceneStartscreen)) {
  36. scene_manager_stop(app->scene_manager);
  37. view_dispatcher_stop(app->view_dispatcher);
  38. }
  39. consumed = true;
  40. break;
  41. }
  42. }
  43. return consumed;
  44. }
  45. void flipbip_scene_startscreen_on_exit(void* context) {
  46. FlipBip* app = context;
  47. UNUSED(app);
  48. }