app.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // app.c
  2. #include <jsmn.h> // Include cJSON
  3. #include <uart_text_input.h> // Include the text input widget
  4. #include <flip_social_e.h> // Include the FlipSocialApp structure
  5. #include <flip_social_storage.h> // Include the storage functions
  6. #include "flip_social_draw.h"
  7. #include "flip_social_feed.h"
  8. #include "flip_social_explore.h"
  9. #include "flip_social_friends.h"
  10. #include <flip_social_callback.h> // Include the callback functions
  11. #include <flip_social_i.h> // Include the initialization functions
  12. #include <flip_social_free.h> // Include the cleanup functions
  13. /**
  14. * @brief Entry point for the Hello World application.
  15. * @details Initializes the app, runs the view dispatcher, and cleans up upon exit.
  16. * @param p Input parameter - unused
  17. * @return 0 to indicate success, -1 on failure
  18. */
  19. int32_t main_flip_social(void *p)
  20. {
  21. UNUSED(p);
  22. // Initialize the Hello World application
  23. FlipSocialApp *app = flip_social_app_alloc();
  24. if (!app)
  25. {
  26. // Allocation failed
  27. return -1; // Indicate failure
  28. }
  29. // send settings and connect wifi
  30. if (!flipper_http_connect_wifi())
  31. {
  32. FURI_LOG_E(TAG, "Failed to connect to WiFi");
  33. return -1;
  34. }
  35. if (!flipper_http_ping())
  36. {
  37. FURI_LOG_E(TAG, "Failed to ping the device");
  38. return -1;
  39. }
  40. // Run the view dispatcher
  41. view_dispatcher_run(app->view_dispatcher);
  42. // Free the resources used by the Hello World application
  43. flip_social_app_free(app);
  44. // Return 0 to indicate success
  45. return 0;
  46. }