evil_portal_scene_select_html.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "../evil_portal_app_i.h"
  2. #include "../helpers/evil_portal_storage.h"
  3. void evil_portal_scene_select_html_on_enter(void *context) {
  4. Evil_PortalApp *app = context;
  5. DialogsFileBrowserOptions browser_options;
  6. evil_portal_create_html_folder_if_not_exists();
  7. dialog_file_browser_set_basic_options(&browser_options, HTML_EXTENSION, &I_evil_portal_10px);
  8. browser_options.base_path = HTML_FOLDER;
  9. FuriString* path;
  10. path = furi_string_alloc();
  11. furi_string_set(path, HTML_FOLDER);
  12. bool success = dialog_file_browser_show(
  13. app->dialogs, app->file_path, path, &browser_options);
  14. furi_string_free(path);
  15. if(success) {
  16. //Replace HTML File
  17. evil_portal_replace_index_html(app->file_path);
  18. }
  19. if(success) {
  20. scene_manager_search_and_switch_to_previous_scene(
  21. app->scene_manager, Evil_PortalSceneStart);
  22. } else {
  23. scene_manager_previous_scene(app->scene_manager);
  24. }
  25. }
  26. bool evil_portal_scene_select_html_on_event(void *context, SceneManagerEvent event) {
  27. UNUSED(context);
  28. UNUSED(event);
  29. bool consumed = true;
  30. return consumed;
  31. }
  32. void evil_portal_scene_select_html_on_exit(void *context) {
  33. UNUSED(context);
  34. }