pof_scene_file_select.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "../portal_of_flipper_i.h"
  2. #include "../pof_token.h"
  3. #define TAG "PoFSceneFileSelect"
  4. void pof_scene_file_select_on_enter(void* context) {
  5. PoFApp* pof = context;
  6. VirtualPortal* virtual_portal = pof->virtual_portal;
  7. PoFToken* pof_token = NULL;
  8. for(int i = 0; i < POF_TOKEN_LIMIT; i++) {
  9. if(virtual_portal->tokens[i]->loaded == false) {
  10. FURI_LOG_D(TAG, "Loading to slot %d", i);
  11. pof_token = virtual_portal->tokens[i];
  12. break;
  13. }
  14. }
  15. // Process file_select return
  16. pof_token_set_loading_callback(pof_token, pof_show_loading_popup, pof);
  17. if(pof_token && pof_file_select(pof_token)) {
  18. scene_manager_next_scene(pof->scene_manager, PoFSceneMain);
  19. } else {
  20. scene_manager_search_and_switch_to_previous_scene(pof->scene_manager, PoFSceneMain);
  21. }
  22. pof_token_set_loading_callback(pof_token, NULL, pof);
  23. }
  24. bool pof_scene_file_select_on_event(void* context, SceneManagerEvent event) {
  25. UNUSED(context);
  26. UNUSED(event);
  27. return false;
  28. }
  29. void pof_scene_file_select_on_exit(void* context) {
  30. UNUSED(context);
  31. }