desktop_scene_first_start.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "../desktop_i.h"
  2. #include "../views/desktop_first_start.h"
  3. #include "applications/dolphin/dolphin.h"
  4. void desktop_scene_first_start_callback(DesktopFirstStartEvent event, void* context) {
  5. Desktop* desktop = (Desktop*)context;
  6. view_dispatcher_send_custom_event(desktop->view_dispatcher, event);
  7. }
  8. const void desktop_scene_first_start_on_enter(void* context) {
  9. Desktop* desktop = (Desktop*)context;
  10. DesktopFirstStartView* first_start_view = desktop->first_start_view;
  11. desktop_first_start_set_callback(
  12. first_start_view, desktop_scene_first_start_callback, desktop);
  13. view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewFirstStart);
  14. }
  15. const bool desktop_scene_first_start_on_event(void* context, SceneManagerEvent event) {
  16. Desktop* desktop = (Desktop*)context;
  17. bool consumed = false;
  18. if(event.type == SceneManagerEventTypeCustom) {
  19. switch(event.event) {
  20. case DesktopFirstStartCompleted:
  21. scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain);
  22. consumed = true;
  23. break;
  24. default:
  25. break;
  26. }
  27. }
  28. return consumed;
  29. }
  30. const void desktop_scene_first_start_on_exit(void* context) {
  31. // Desktop* desktop = (Desktop*)context;
  32. Dolphin* dolphin = furi_record_open("dolphin");
  33. dolphin_save(dolphin);
  34. furi_record_close("dolphin");
  35. }