flipbip39_scene_scene_2.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include "../flipbip39.h"
  2. #include "../helpers/flipbip39_custom_event.h"
  3. #include "../helpers/flipbip39_haptic.h"
  4. #include "../helpers/flipbip39_led.h"
  5. #include "../views/flipbip39_scene_2.h"
  6. void flipbip39_scene_2_callback(FlipBip39CustomEvent event, void* context) {
  7. furi_assert(context);
  8. FlipBip39* app = context;
  9. view_dispatcher_send_custom_event(app->view_dispatcher, event);
  10. }
  11. void flipbip39_scene_scene_2_on_enter(void* context) {
  12. furi_assert(context);
  13. FlipBip39* app = context;
  14. flipbip39_scene_2_set_callback(app->flipbip39_scene_2, flipbip39_scene_2_callback, app);
  15. view_dispatcher_switch_to_view(app->view_dispatcher, FlipBip39ViewIdScene2);
  16. }
  17. bool flipbip39_scene_scene_2_on_event(void* context, SceneManagerEvent event) {
  18. FlipBip39* app = context;
  19. bool consumed = false;
  20. if(event.type == SceneManagerEventTypeCustom) {
  21. switch(event.event) {
  22. case FlipBip39CustomEventScene2Left:
  23. case FlipBip39CustomEventScene2Right:
  24. break;
  25. case FlipBip39CustomEventScene2Up:
  26. case FlipBip39CustomEventScene2Down:
  27. break;
  28. case FlipBip39CustomEventScene2Back:
  29. notification_message(app->notification, &sequence_reset_red);
  30. notification_message(app->notification, &sequence_reset_green);
  31. notification_message(app->notification, &sequence_reset_blue);
  32. if(!scene_manager_search_and_switch_to_previous_scene(
  33. app->scene_manager, FlipBip39SceneMenu)) {
  34. scene_manager_stop(app->scene_manager);
  35. view_dispatcher_stop(app->view_dispatcher);
  36. }
  37. consumed = true;
  38. break;
  39. }
  40. }
  41. return consumed;
  42. }
  43. void flipbip39_scene_scene_2_on_exit(void* context) {
  44. FlipBip39* app = context;
  45. UNUSED(app);
  46. }