flip_social_callback.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. #ifndef FLIP_SOCIAL_CALLBACK_H
  2. #define FLIP_SOCIAL_CALLBACK_H
  3. #include <flip_social.h>
  4. #include <messages/flip_social_messages.h>
  5. #include <friends/flip_social_friends.h>
  6. #include <explore/flip_social_explore.h>
  7. #include <feed/flip_social_feed.h>
  8. #include <flip_storage/flip_social_storage.h>
  9. /**
  10. * @brief Navigation callback to go back to the submenu Logged out.
  11. * @param context The context - unused
  12. * @return next view id (FlipSocialViewLoggedOutSubmenu)
  13. */
  14. uint32_t flip_social_callback_to_submenu_logged_out(void *context);
  15. /**
  16. * @brief Navigation callback to go back to the submenu Logged in.
  17. * @param context The context - unused
  18. * @return next view id (FlipSocialViewLoggedInSubmenu)
  19. */
  20. uint32_t flip_social_callback_to_submenu_logged_in(void *context);
  21. /**
  22. * @brief Navigation callback to bring the user back to the (Logged out) Login screen
  23. * @param context The context - unused
  24. * @return next view id (FlipSocialViewLoggedOutLogin)
  25. */
  26. uint32_t flip_social_callback_to_login_logged_out(void *context);
  27. /**
  28. * @brief Navigation callback to bring the user back to the (Logged out) Register screen
  29. * @param context The context - unused
  30. * @return next view id (FlipSocialViewLoggedOutRegister)
  31. */
  32. uint32_t flip_social_callback_to_register_logged_out(void *context);
  33. /**
  34. * @brief Navigation callback to bring the user back to the (Logged out) Wifi Settings screen
  35. * @param context The context - unused
  36. * @return next view id (FlipSocialViewLoggedOutWifiSettings)
  37. */
  38. uint32_t flip_social_callback_to_wifi_settings_logged_out(void *context);
  39. /**
  40. * @brief Navigation callback to bring the user back to the (Logged in) Wifi Settings screen
  41. * @param context The context - unused
  42. * @return next view id (FlipSocialViewLoggedInSettingsWifi)
  43. */
  44. uint32_t flip_social_callback_to_wifi_settings_logged_in(void *context);
  45. /**
  46. * @brief Navigation callback to bring the user back to the (Logged in) Settings screen
  47. * @param context The context - unused
  48. * @return next view id (FlipSocialViewLoggedInSettingsWifi)
  49. */
  50. uint32_t flip_social_callback_to_settings_logged_in(void *context);
  51. /**
  52. * @brief Navigation callback to bring the user back to the (Logged in) Compose screen
  53. * @param context The context - unused
  54. * @return next view id (FlipSocialViewLoggedInCompose)
  55. */
  56. uint32_t flip_social_callback_to_compose_logged_in(void *context);
  57. /**
  58. * @brief Navigation callback to bring the user back to the (Logged in) Profile screen
  59. * @param context The context - unused
  60. * @return next view id (FlipSocialViewLoggedInProfile)
  61. */
  62. uint32_t flip_social_callback_to_profile_logged_in(void *context);
  63. /**
  64. * @brief Navigation callback to bring the user back to the Explore submenu
  65. * @param context The context - unused
  66. * @return next view id (FlipSocialViewLoggedInExploreSubmenu)
  67. */
  68. uint32_t flip_social_callback_to_explore_logged_in(void *context);
  69. /**
  70. * @brief Navigation callback to bring the user back to the Friends submenu
  71. * @param context The context - unused
  72. * @return next view id (FlipSocialViewLoggedInFriendsSubmenu)
  73. */
  74. uint32_t flip_social_callback_to_friends_logged_in(void *context);
  75. /**
  76. * @brief Navigation callback to bring the user back to the Messages submenu
  77. * @param context The context - unused
  78. * @return next view id (FlipSocialViewLoggedInMessagesSubmenu)
  79. */
  80. uint32_t flip_social_callback_to_messages_logged_in(void *context);
  81. /**
  82. * @brief Navigation callback to bring the user back to the User Choices screen
  83. * @param context The context - unused
  84. * @return next view id (FlipSocialViewLoggedInMessagesUserChoices)
  85. */
  86. uint32_t flip_social_callback_to_messages_user_choices(void *context);
  87. /**
  88. * @brief Navigation callback for exiting the application
  89. * @param context The context - unused
  90. * @return next view id (VIEW_NONE to exit the app)
  91. */
  92. uint32_t flip_social_callback_exit_app(void *context);
  93. /**
  94. * @brief Handle ALL submenu item selections.
  95. * @param context The context - FlipSocialApp object.
  96. * @param index The FlipSocialSubmenuIndex item that was clicked.
  97. * @return void
  98. */
  99. void flip_social_callback_submenu_choices(void *context, uint32_t index);
  100. /**
  101. * @brief Text input callback for when the user finishes entering their SSID on the wifi settings (logged out) screen.
  102. * @param context The context - FlipSocialApp object.
  103. * @return void
  104. */
  105. void flip_social_logged_out_wifi_settings_ssid_updated(void *context);
  106. /**
  107. * @brief Text input callback for when the user finishes entering their password on the wifi settings (logged out) screen.
  108. * @param context The context - FlipSocialApp object.
  109. * @return void
  110. */
  111. void flip_social_logged_out_wifi_settings_password_updated(void *context);
  112. /**
  113. * @brief Callback when the user selects a menu item in the wifi settings (logged out) screen.
  114. * @param context The context - FlipSocialApp object.
  115. * @param index The index of the selected item.
  116. * @return void
  117. */
  118. void flip_social_text_input_logged_out_wifi_settings_item_selected(void *context, uint32_t index);
  119. /**
  120. * @brief Text input callback for when the user finishes entering their username on the login (logged out) screen.
  121. * @param context The context - FlipSocialApp object.
  122. * @return void
  123. */
  124. void flip_social_logged_out_login_username_updated(void *context);
  125. /**
  126. * @brief Text input callback for when the user finishes entering their password on the login (logged out) screen.
  127. * @param context The context - FlipSocialApp object.
  128. * @return void
  129. */
  130. void flip_social_logged_out_login_password_updated(void *context);
  131. /**
  132. * @brief Callback when the user selects a menu item in the login (logged out) screen.
  133. * @param context The context - FlipSocialApp object.
  134. * @param index The index of the selected item.
  135. * @return void
  136. */
  137. void flip_social_text_input_logged_out_login_item_selected(void *context, uint32_t index);
  138. /**
  139. * @brief Text input callback for when the user finishes entering their username on the register (logged out) screen.
  140. * @param context The context - FlipSocialApp object.
  141. * @return void
  142. */
  143. void flip_social_logged_out_register_username_updated(void *context);
  144. /**
  145. * @brief Text input callback for when the user finishes entering their password on the register (logged out) screen.
  146. * @param context The context - FlipSocialApp object.
  147. * @return void
  148. */
  149. void flip_social_logged_out_register_password_updated(void *context);
  150. /**
  151. * @brief Text input callback for when the user finishes entering their password 2 on the register (logged out) screen.
  152. * @param context The context - FlipSocialApp object.
  153. * @return void
  154. */
  155. void flip_social_logged_out_register_password_2_updated(void *context);
  156. /**
  157. * @brief Text input callback for when the user finishes entering their SSID on the wifi settings (logged in) screen.
  158. * @param context The context - FlipSocialApp object.
  159. * @return void
  160. */
  161. void flip_social_logged_in_wifi_settings_ssid_updated(void *context);
  162. /**
  163. * @brief Text input callback for when the user finishes entering their password on the wifi settings (logged in) screen.
  164. * @param context The context - FlipSocialApp object.
  165. * @return void
  166. */
  167. void flip_social_logged_in_wifi_settings_password_updated(void *context);
  168. /**
  169. * @brief Callback when the user selects a menu item in the wifi settings (logged in) screen.
  170. * @param context The context - FlipSocialApp object.
  171. * @param index The index of the selected item.
  172. * @return void
  173. */
  174. void flip_social_text_input_logged_in_wifi_settings_item_selected(void *context, uint32_t index);
  175. /**
  176. * @brief Text input callback for when the user finishes entering their message on the compose (logged in) screen for Add Text
  177. * @param context The context - FlipSocialApp object.
  178. * @return void
  179. */
  180. void flip_social_logged_in_compose_pre_save_updated(void *context);
  181. /**
  182. * @brief Text input callback for when the user finishes entering their message on the profile (logged in) screen for change password
  183. * @param context The context - FlipSocialApp object.
  184. * @return void
  185. */
  186. void flip_social_logged_in_profile_change_password_updated(void *context);
  187. /**
  188. * @brief Callback when a user selects a menu item in the profile (logged in) screen.
  189. * @param context The context - FlipSocialApp object.
  190. * @param index The index of the selected item.
  191. * @return void
  192. */
  193. void flip_social_logged_in_profile_change_bio_updated(void *context);
  194. void flip_social_text_input_logged_in_profile_item_selected(void *context, uint32_t index);
  195. /**
  196. * @brief Callback when a user selects a menu item in the settings (logged in) screen.
  197. * @param context The context - FlipSocialApp object.
  198. * @param index The index of the selected item.
  199. * @return void
  200. */
  201. void flip_social_text_input_logged_in_settings_item_selected(void *context, uint32_t index);
  202. /**
  203. * @brief Text input callback for when the user finishes entering their message to send to the selected user choice (user choice messages view)
  204. * @param context The context - FlipSocialApp object.
  205. * @return void
  206. */
  207. void flip_social_logged_in_messages_user_choice_message_updated(void *context);
  208. /**
  209. * @brief Text input callback for when the user finishes entering their message to the selected user (messages view)
  210. * @param context The context - FlipSocialApp object.
  211. * @return void
  212. */
  213. void flip_social_logged_in_messages_new_message_updated(void *context);
  214. /**
  215. * @brief Callback when the user selects a menu item in the register (logged out) screen.
  216. * @param context The context - FlipSocialApp object.
  217. * @param index The index of the selected item.
  218. * @return void
  219. */
  220. void flip_social_text_input_logged_out_register_item_selected(void *context, uint32_t index);
  221. void flip_social_logged_in_explore_updated(void *context);
  222. void flip_social_logged_in_message_users_updated(void *context);
  223. // Add edits by Derek Jamison
  224. typedef enum DataState DataState;
  225. enum DataState
  226. {
  227. DataStateInitial,
  228. DataStateRequested,
  229. DataStateReceived,
  230. DataStateParsed,
  231. DataStateParseError,
  232. DataStateError,
  233. };
  234. typedef enum FlipSocialCustomEvent FlipSocialCustomEvent;
  235. enum FlipSocialCustomEvent
  236. {
  237. FlipSocialCustomEventProcess,
  238. };
  239. typedef struct DataLoaderModel DataLoaderModel;
  240. typedef bool (*DataLoaderFetch)(DataLoaderModel *model);
  241. typedef char *(*DataLoaderParser)(DataLoaderModel *model);
  242. struct DataLoaderModel
  243. {
  244. char *title;
  245. char *data_text;
  246. DataState data_state;
  247. DataLoaderFetch fetcher;
  248. DataLoaderParser parser;
  249. void *parser_context;
  250. size_t request_index;
  251. size_t request_count;
  252. ViewNavigationCallback back_callback;
  253. FuriTimer *timer;
  254. };
  255. void flip_social_generic_switch_to_view(FlipSocialApp *app, char *title, DataLoaderFetch fetcher, DataLoaderParser parser, size_t request_count, ViewNavigationCallback back, uint32_t view_id);
  256. void flip_social_loader_draw_callback(Canvas *canvas, void *model);
  257. void flip_social_loader_init(View *view);
  258. void flip_social_loader_free_model(View *view);
  259. bool flip_social_custom_event_callback(void *context, uint32_t index);
  260. bool messages_dialog_alloc(bool free_first);
  261. bool feed_dialog_alloc();
  262. #endif