flip_library_callback.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef FLIP_LIBRARY_CALLBACK_H
  2. #define FLIP_LIBRARY_CALLBACK_H
  3. #include <flip_library.h>
  4. #include <flip_storage/flip_library_storage.h>
  5. #define MAX_TOKENS 512 // Adjust based on expected JSON size
  6. extern uint32_t random_facts_index;
  7. extern bool sent_random_fact_request;
  8. extern bool random_fact_request_success;
  9. extern bool random_fact_request_success_all;
  10. extern char* random_fact;
  11. // Parse JSON to find the "text" key
  12. char* flip_library_parse_random_fact();
  13. char* flip_library_parse_cat_fact();
  14. char* flip_library_parse_dog_fact();
  15. char* flip_library_parse_quote();
  16. char* flip_library_parse_dictionary();
  17. void flip_library_request_error(Canvas* canvas);
  18. void flip_library_draw_fact(char* message, Widget** widget);
  19. // Callback for drawing the main screen
  20. void view_draw_callback_random_facts(Canvas* canvas, void* model);
  21. void view_draw_callback_dictionary_run(Canvas* canvas, void* model);
  22. // Input callback for the view (async input handling)
  23. bool view_input_callback_random_facts(InputEvent* event, void* context);
  24. void callback_submenu_choices(void* context, uint32_t index);
  25. void text_updated_ssid(void* context);
  26. void text_updated_password(void* context);
  27. void text_updated_dictionary(void* context);
  28. uint32_t callback_to_submenu(void* context);
  29. uint32_t callback_to_wifi_settings(void* context);
  30. uint32_t callback_to_random_facts(void* context);
  31. void settings_item_selected(void* context, uint32_t index);
  32. /**
  33. * @brief Navigation callback for exiting the application
  34. * @param context The context - unused
  35. * @return next view id (VIEW_NONE to exit the app)
  36. */
  37. uint32_t callback_exit_app(void* context);
  38. #endif // FLIP_LIBRARY_CALLBACK_H