app.c 1.6 KB

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