callback.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. #ifndef FLIP_SOCIAL_CALLBACK_H
  2. #define FLIP_SOCIAL_CALLBACK_H
  3. #include <flip_social.h>
  4. // replica of flipper_http_load_task but allows FlipperHTTP to be passed in
  5. typedef bool (*LoadingCallback)(FlipperHTTP *);
  6. void callback_loading_task(FlipperHTTP *fhttp,
  7. LoadingCallback http_request,
  8. LoadingCallback parse_response,
  9. uint32_t success_view_id,
  10. uint32_t failure_view_id,
  11. ViewDispatcher **view_dispatcher,
  12. bool should_free_loader);
  13. bool callback_request_await(FlipperHTTP *fhttp, LoadingCallback http_request, LoadingCallback parse_response);
  14. /**
  15. * @brief Navigation callback to go back to the submenu Logged out.
  16. * @param context The context - unused
  17. * @return next view id (FlipSocialViewLoggedOutSubmenu)
  18. */
  19. uint32_t callback_to_submenu_logged_out(void *context);
  20. /**
  21. * @brief Navigation callback to go back to the submenu Logged in.
  22. * @param context The context - unused
  23. * @return next view id (FlipSocialViewLoggedInSubmenu)
  24. */
  25. uint32_t callback_to_submenu_logged_in(void *context);
  26. /**
  27. * @brief Navigation callback to bring the user back to the (Logged out) Login screen
  28. * @param context The context - unused
  29. * @return next view id (FlipSocialViewLoggedOutLogin)
  30. */
  31. uint32_t callback_to_login_logged_out(void *context);
  32. /**
  33. * @brief Navigation callback to bring the user back to the (Logged out) Register screen
  34. * @param context The context - unused
  35. * @return next view id (FlipSocialViewLoggedOutRegister)
  36. */
  37. uint32_t callback_to_register_logged_out(void *context);
  38. /**
  39. * @brief Navigation callback to bring the user back to the (Logged out) Wifi Settings screen
  40. * @param context The context - unused
  41. * @return next view id (FlipSocialViewLoggedOutWifiSettings)
  42. */
  43. uint32_t callback_to_wifi_settings_logged_out(void *context);
  44. /**
  45. * @brief Navigation callback to bring the user back to the (Logged in) Wifi Settings screen
  46. * @param context The context - unused
  47. * @return next view id (FlipSocialViewLoggedInSettingsWifi)
  48. */
  49. uint32_t callback_to_wifi_settings_logged_in(void *context);
  50. /**
  51. * @brief Navigation callback to bring the user back to the (Logged in) Settings screen
  52. * @param context The context - unused
  53. * @return next view id (FlipSocialViewLoggedInSettingsWifi)
  54. */
  55. uint32_t callback_to_settings_logged_in(void *context);
  56. /**
  57. * @brief Navigation callback to bring the user back to the (Logged in) Compose screen
  58. * @param context The context - unused
  59. * @return next view id (FlipSocialViewLoggedInCompose)
  60. */
  61. uint32_t callback_to_compose_logged_in(void *context);
  62. /**
  63. * @brief Navigation callback to bring the user back to the (Logged in) Profile screen
  64. * @param context The context - unused
  65. * @return next view id (FlipSocialViewLoggedInProfile)
  66. */
  67. uint32_t callback_to_profile_logged_in(void *context);
  68. /**
  69. * @brief Navigation callback to bring the user back to the Explore submenu
  70. * @param context The context - unused
  71. * @return next view id (FlipSocialViewLoggedInExploreSubmenu)
  72. */
  73. uint32_t callback_to_explore_logged_in(void *context);
  74. /**
  75. * @brief Navigation callback to bring the user back to the Friends submenu
  76. * @param context The context - unused
  77. * @return next view id (FlipSocialViewLoggedInFriendsSubmenu)
  78. */
  79. uint32_t callback_to_friends_logged_in(void *context);
  80. /**
  81. * @brief Navigation callback to bring the user back to the Messages submenu
  82. * @param context The context - unused
  83. * @return next view id (FlipSocialViewLoggedInMessagesSubmenu)
  84. */
  85. uint32_t callback_to_messages_logged_in(void *context);
  86. /**
  87. * @brief Navigation callback to bring the user back to the User Choices screen
  88. * @param context The context - unused
  89. * @return next view id (FlipSocialViewLoggedInMessagesUserChoices)
  90. */
  91. uint32_t callback_to_messages_user_choices(void *context);
  92. /**
  93. * @brief Navigation callback for exiting the application
  94. * @param context The context - unused
  95. * @return next view id (VIEW_NONE to exit the app)
  96. */
  97. uint32_t callback_exit_app(void *context);
  98. void callback_feed_draw(Canvas *canvas, void *model);
  99. bool callback_feed_input(InputEvent *event, void *context);
  100. /**
  101. * @brief Handle ALL submenu item selections.
  102. * @param context The context - FlipSocialApp object.
  103. * @param index The FlipSocialSubmenuIndex item that was clicked.
  104. * @return void
  105. */
  106. void callback_submenu_choices(void *context, uint32_t index);
  107. /**
  108. * @brief Text input callback for when the user finishes entering their SSID on the wifi settings (logged out) screen.
  109. * @param context The context - FlipSocialApp object.
  110. * @return void
  111. */
  112. void callback_logged_out_wifi_settings_ssid_updated(void *context);
  113. /**
  114. * @brief Text input callback for when the user finishes entering their password on the wifi settings (logged out) screen.
  115. * @param context The context - FlipSocialApp object.
  116. * @return void
  117. */
  118. void callback_logged_out_wifi_settings_password_updated(void *context);
  119. /**
  120. * @brief Callback when the user selects a menu item in the wifi settings (logged out) screen.
  121. * @param context The context - FlipSocialApp object.
  122. * @param index The index of the selected item.
  123. * @return void
  124. */
  125. void callback_logged_out_wifi_settings_item_selected(void *context, uint32_t index);
  126. /**
  127. * @brief Text input callback for when the user finishes entering their username on the login (logged out) screen.
  128. * @param context The context - FlipSocialApp object.
  129. * @return void
  130. */
  131. void callback_logged_out_login_username_updated(void *context);
  132. /**
  133. * @brief Text input callback for when the user finishes entering their password on the login (logged out) screen.
  134. * @param context The context - FlipSocialApp object.
  135. * @return void
  136. */
  137. void callback_logged_out_login_password_updated(void *context);
  138. /**
  139. * @brief Callback when the user selects a menu item in the login (logged out) screen.
  140. * @param context The context - FlipSocialApp object.
  141. * @param index The index of the selected item.
  142. * @return void
  143. */
  144. void callback_logged_out_login_item_selected(void *context, uint32_t index);
  145. /**
  146. * @brief Text input callback for when the user finishes entering their username on the register (logged out) screen.
  147. * @param context The context - FlipSocialApp object.
  148. * @return void
  149. */
  150. void callback_logged_out_register_username_updated(void *context);
  151. /**
  152. * @brief Text input callback for when the user finishes entering their password on the register (logged out) screen.
  153. * @param context The context - FlipSocialApp object.
  154. * @return void
  155. */
  156. void callback_logged_out_register_password_updated(void *context);
  157. /**
  158. * @brief Text input callback for when the user finishes entering their password 2 on the register (logged out) screen.
  159. * @param context The context - FlipSocialApp object.
  160. * @return void
  161. */
  162. void callback_logged_out_register_password_2_updated(void *context);
  163. /**
  164. * @brief Text input callback for when the user finishes entering their SSID on the wifi settings (logged in) screen.
  165. * @param context The context - FlipSocialApp object.
  166. * @return void
  167. */
  168. void callback_logged_in_wifi_settings_ssid_updated(void *context);
  169. /**
  170. * @brief Text input callback for when the user finishes entering their password on the wifi settings (logged in) screen.
  171. * @param context The context - FlipSocialApp object.
  172. * @return void
  173. */
  174. void callback_logged_in_wifi_settings_password_updated(void *context);
  175. /**
  176. * @brief Callback when the user selects a menu item in the wifi settings (logged in) screen.
  177. * @param context The context - FlipSocialApp object.
  178. * @param index The index of the selected item.
  179. * @return void
  180. */
  181. void callback_logged_in_wifi_settings_item_selected(void *context, uint32_t index);
  182. /**
  183. * @brief Text input callback for when the user finishes entering their message on the compose (logged in) screen for Add Text
  184. * @param context The context - FlipSocialApp object.
  185. * @return void
  186. */
  187. void callback_logged_in_compose_pre_save_updated(void *context);
  188. /**
  189. * @brief Text input callback for when the user finishes entering their message on the profile (logged in) screen for change password
  190. * @param context The context - FlipSocialApp object.
  191. * @return void
  192. */
  193. void callback_logged_in_profile_change_password_updated(void *context);
  194. /**
  195. * @brief Callback when a user selects a menu item in the profile (logged in) screen.
  196. * @param context The context - FlipSocialApp object.
  197. * @param index The index of the selected item.
  198. * @return void
  199. */
  200. void callback_logged_in_profile_change_bio_updated(void *context);
  201. void callback_logged_in_profile_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 callback_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 callback_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 callback_logged_out_register_item_selected(void *context, uint32_t index);
  221. void callback_logged_in_user_settings_item_selected(void *context, uint32_t index);
  222. void callback_logged_in_explore_updated(void *context);
  223. void callback_logged_in_message_users_updated(void *context);
  224. void callback_message_dialog(DialogExResult result, void *context);
  225. //
  226. bool callback_home_notification(FlipperHTTP *fhttp);
  227. #endif