flip_store.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #include <flip_store.h>
  2. // define the list of categories
  3. char* categories[] = {
  4. "Bluetooth",
  5. "Games",
  6. "GPIO",
  7. "Infrared",
  8. "iButton",
  9. "Media",
  10. "NFC",
  11. "RFID",
  12. "Sub-GHz",
  13. "Tools",
  14. "USB",
  15. };
  16. // Function to free the resources used by FlipStoreApp
  17. void flip_store_app_free(FlipStoreApp* app) {
  18. if(!app) {
  19. FURI_LOG_E(TAG, "FlipStoreApp is NULL");
  20. return;
  21. }
  22. // Free View(s)
  23. if(app->view_main) {
  24. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewMain);
  25. view_free(app->view_main);
  26. }
  27. if(app->view_app_info) {
  28. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppInfo);
  29. view_free(app->view_app_info);
  30. }
  31. // Free Submenu(s)
  32. if(app->submenu) {
  33. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewSubmenu);
  34. submenu_free(app->submenu);
  35. }
  36. if(app->submenu_app_list) {
  37. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppList);
  38. submenu_free(app->submenu_app_list);
  39. }
  40. if(app->submenu_app_list_bluetooth) {
  41. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListBluetooth);
  42. submenu_free(app->submenu_app_list_bluetooth);
  43. }
  44. if(app->submenu_app_list_games) {
  45. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListGames);
  46. submenu_free(app->submenu_app_list_games);
  47. }
  48. if(app->submenu_app_list_gpio) {
  49. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListGPIO);
  50. submenu_free(app->submenu_app_list_gpio);
  51. }
  52. if(app->submenu_app_list_infrared) {
  53. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListInfrared);
  54. submenu_free(app->submenu_app_list_infrared);
  55. }
  56. if(app->submenu_app_list_ibutton) {
  57. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListiButton);
  58. submenu_free(app->submenu_app_list_ibutton);
  59. }
  60. if(app->submenu_app_list_media) {
  61. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListMedia);
  62. submenu_free(app->submenu_app_list_media);
  63. }
  64. if(app->submenu_app_list_nfc) {
  65. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListNFC);
  66. submenu_free(app->submenu_app_list_nfc);
  67. }
  68. if(app->submenu_app_list_rfid) {
  69. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListRFID);
  70. submenu_free(app->submenu_app_list_rfid);
  71. }
  72. if(app->submenu_app_list_subghz) {
  73. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListSubGHz);
  74. submenu_free(app->submenu_app_list_subghz);
  75. }
  76. if(app->submenu_app_list_tools) {
  77. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListTools);
  78. submenu_free(app->submenu_app_list_tools);
  79. }
  80. if(app->submenu_app_list_usb) {
  81. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppListUSB);
  82. submenu_free(app->submenu_app_list_usb);
  83. }
  84. // Free Widget(s)
  85. if(app->widget) {
  86. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAbout);
  87. widget_free(app->widget);
  88. }
  89. // Free Variable Item List(s)
  90. if(app->variable_item_list) {
  91. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewSettings);
  92. variable_item_list_free(app->variable_item_list);
  93. }
  94. // Free Text Input(s)
  95. if(app->uart_text_input_ssid) {
  96. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewTextInputSSID);
  97. text_input_free(app->uart_text_input_ssid);
  98. }
  99. if(app->uart_text_input_pass) {
  100. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewTextInputPass);
  101. text_input_free(app->uart_text_input_pass);
  102. }
  103. // Free popup
  104. if(app->popup) {
  105. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewPopup);
  106. popup_free(app->popup);
  107. }
  108. // Free dialog
  109. if(app->dialog_delete) {
  110. view_dispatcher_remove_view(app->view_dispatcher, FlipStoreViewAppDelete);
  111. dialog_ex_free(app->dialog_delete);
  112. }
  113. // deinitalize flipper http
  114. flipper_http_deinit();
  115. // free the view dispatcher
  116. view_dispatcher_free(app->view_dispatcher);
  117. // close the gui
  118. furi_record_close(RECORD_GUI);
  119. // free the app
  120. free(app);
  121. }