Просмотр исходного кода

Refactoring

- Moves nfc_playlist_worker into a lib folder
- Refactoring
acegoal07 2 лет назад
Родитель
Сommit
f3fcc1dbea
10 измененных файлов с 87 добавлено и 92 удалено
  1. 5 0
      application.fam
  2. 1 1
      build.txt
  3. 0 0
      lib/worker/nfc_playlist_worker.c
  4. 0 0
      lib/worker/nfc_playlist_worker.h
  5. 33 36
      nfc_playlist.c
  6. 2 4
      nfc_playlist.h
  7. 20 20
      scences/emulation.c
  8. 0 4
      scences/emulation.h
  9. 26 23
      scences/main_menu.c
  10. 0 4
      scences/main_menu.h

+ 5 - 0
application.fam

@@ -9,4 +9,9 @@ App(
     fap_author="@acegoal07",
     fap_author="@acegoal07",
     fap_weburl="https://github.com/acegoal07/FlipperZero_NFC_Playlist/tree/main",
     fap_weburl="https://github.com/acegoal07/FlipperZero_NFC_Playlist/tree/main",
     fap_version="1.0",
     fap_version="1.0",
+    fap_private_libs=[
+        Lib(
+            name="worker",
+        ),
+    ],
 )
 )

+ 1 - 1
build.txt

@@ -1 +1 @@
-fbt fap_nfc_playlist && fbt launch_app APPSRC=applications_user/nfc_playlist
+fbt fap_nfc_playlist && fbt launch APPSRC=applications_user/nfc_playlist

+ 0 - 0
nfc_playlist_worker.c → lib/worker/nfc_playlist_worker.c


+ 0 - 0
nfc_playlist_worker.h → lib/worker/nfc_playlist_worker.h


+ 33 - 36
nfc_playlist.c

@@ -25,66 +25,63 @@ static const SceneManagerHandlers nfc_playlist_scene_manager_handlers = {
 
 
 static bool nfc_playlist_custom_callback(void* context, uint32_t custom_event) {
 static bool nfc_playlist_custom_callback(void* context, uint32_t custom_event) {
     furi_assert(context);
     furi_assert(context);
-    NfcPlaylist* app = context;
-    return scene_manager_handle_custom_event(app->scene_manager, custom_event);
+    NfcPlaylist* nfc_playlist = context;
+    return scene_manager_handle_custom_event(nfc_playlist->scene_manager, custom_event);
 }
 }
 
 
 static bool nfc_playlist_back_event_callback(void* context) {
 static bool nfc_playlist_back_event_callback(void* context) {
     furi_assert(context);
     furi_assert(context);
-    NfcPlaylist* app = context;
-    return scene_manager_handle_back_event(app->scene_manager);
+    NfcPlaylist* nfc_playlist = context;
+    return scene_manager_handle_back_event(nfc_playlist->scene_manager);
 }
 }
 
 
 static NfcPlaylist* nfc_playlist_alloc() {
 static NfcPlaylist* nfc_playlist_alloc() {
+    NfcPlaylist* nfc_playlist = malloc(sizeof(NfcPlaylist));
+    furi_assert(nfc_playlist);
+    nfc_playlist->scene_manager = scene_manager_alloc(&nfc_playlist_scene_manager_handlers, nfc_playlist);
 
 
-    NfcPlaylist* app = malloc(sizeof(NfcPlaylist));
-    furi_assert(app);
-    app->scene_manager = scene_manager_alloc(&nfc_playlist_scene_manager_handlers, app);
+    nfc_playlist->view_dispatcher = view_dispatcher_alloc();
+    view_dispatcher_enable_queue(nfc_playlist->view_dispatcher);
 
 
-    app->view_dispatcher = view_dispatcher_alloc();
-    view_dispatcher_enable_queue(app->view_dispatcher);
+    nfc_playlist->variable_item_list = variable_item_list_alloc();
+    nfc_playlist->popup = popup_alloc();
+    nfc_playlist->emulate_timeout = default_emulate_timeout;
+    nfc_playlist->emulate_delay = default_emulate_delay;
 
 
-    app->variable_item_list = variable_item_list_alloc();
-    app->popup = popup_alloc();
-    app->emulate_timeout = default_emulate_timeout;
-    app->emulate_delay = default_emulate_delay;
+    view_dispatcher_set_event_callback_context(nfc_playlist->view_dispatcher, nfc_playlist);
+    view_dispatcher_set_custom_event_callback(nfc_playlist->view_dispatcher, nfc_playlist_custom_callback);
+    view_dispatcher_set_navigation_event_callback(nfc_playlist->view_dispatcher, nfc_playlist_back_event_callback);
 
 
-    view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
-    view_dispatcher_set_custom_event_callback( app->view_dispatcher, nfc_playlist_custom_callback);
-    view_dispatcher_set_navigation_event_callback(app->view_dispatcher, nfc_playlist_back_event_callback);
+    view_dispatcher_add_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Menu, variable_item_list_get_view(nfc_playlist->variable_item_list));
 
 
-    view_dispatcher_add_view(app->view_dispatcher, NfcPlaylistView_Menu, variable_item_list_get_view(app->variable_item_list));
+    view_dispatcher_add_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Popup, popup_get_view(nfc_playlist->popup));
 
 
-    view_dispatcher_add_view(app->view_dispatcher, NfcPlaylistView_Popup, popup_get_view(app->popup));
-
-    return app;
+    return nfc_playlist;
 }
 }
 
 
-static void nfc_playlist_free(NfcPlaylist* app) {
-    furi_assert(app);
-    scene_manager_free(app->scene_manager);
-    view_dispatcher_remove_view(app->view_dispatcher, NfcPlaylistView_Menu);
-    view_dispatcher_remove_view(app->view_dispatcher, NfcPlaylistView_Popup);
-    view_dispatcher_free(app->view_dispatcher);
-    variable_item_list_free(app->variable_item_list);
-    popup_free(app->popup);
-    free(app);
+static void nfc_playlist_free(NfcPlaylist* nfc_playlist) {
+    furi_assert(nfc_playlist);
+    scene_manager_free(nfc_playlist->scene_manager);
+    view_dispatcher_remove_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Menu);
+    view_dispatcher_remove_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Popup);
+    view_dispatcher_free(nfc_playlist->view_dispatcher);
+    variable_item_list_free(nfc_playlist->variable_item_list);
+    popup_free(nfc_playlist->popup);
+    free(nfc_playlist);
 }
 }
 
 
 int32_t nfc_playlist_main(void* p) {
 int32_t nfc_playlist_main(void* p) {
-   // Mark argument as unused
    UNUSED(p);
    UNUSED(p);
 
 
-   NfcPlaylist* app = nfc_playlist_alloc();
+   NfcPlaylist* nfc_playlist = nfc_playlist_alloc();
 
 
    Gui* gui = furi_record_open(RECORD_GUI);
    Gui* gui = furi_record_open(RECORD_GUI);
-   view_dispatcher_attach_to_gui(app->view_dispatcher, gui, ViewDispatcherTypeFullscreen);
-   scene_manager_next_scene(app->scene_manager, NfcPlaylistScene_MainMenu);
-   view_dispatcher_run(app->view_dispatcher);
+   view_dispatcher_attach_to_gui(nfc_playlist->view_dispatcher, gui, ViewDispatcherTypeFullscreen);
+   scene_manager_next_scene(nfc_playlist->scene_manager, NfcPlaylistScene_MainMenu);
+   view_dispatcher_run(nfc_playlist->view_dispatcher);
 
 
-   // free all memory
    furi_record_close(RECORD_GUI);
    furi_record_close(RECORD_GUI);
-   nfc_playlist_free(app);
+   nfc_playlist_free(nfc_playlist);
 
 
    return 0;
    return 0;
 }
 }

+ 2 - 4
nfc_playlist.h

@@ -1,8 +1,6 @@
 #pragma once
 #pragma once
-
 #include <furi.h>
 #include <furi.h>
 #include <string.h>
 #include <string.h>
-
 #include <gui/gui.h>
 #include <gui/gui.h>
 #include <gui/view_dispatcher.h>
 #include <gui/view_dispatcher.h>
 #include <gui/scene_manager.h>
 #include <gui/scene_manager.h>
@@ -30,6 +28,6 @@ typedef struct {
 } NfcPlaylist;
 } NfcPlaylist;
 
 
 static const int options_emulate_timeout[] = { 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000 };
 static const int options_emulate_timeout[] = { 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000 };
-const int default_emulate_timeout = 4;
+static const int default_emulate_timeout = 4;
 static const int options_emulate_delay[] = { 0, 1000, 2000, 3000, 4000, 5000 };
 static const int options_emulate_delay[] = { 0, 1000, 2000, 3000, 4000, 5000 };
-const int default_emulate_delay = 0;
+static const int default_emulate_delay = 0;

+ 20 - 20
scences/emulation.c

@@ -2,7 +2,7 @@
 #include "scences/emulation.h"
 #include "scences/emulation.h"
 
 
 void nfc_playlist_emulation_scene_on_enter(void* context) {
 void nfc_playlist_emulation_scene_on_enter(void* context) {
-    NfcPlaylist* app = context;
+    NfcPlaylist* nfc_playlist = context;
 
 
     // open/alloc resources
     // open/alloc resources
     Storage* storage = furi_record_open(RECORD_STORAGE);
     Storage* storage = furi_record_open(RECORD_STORAGE);
@@ -11,21 +11,21 @@ void nfc_playlist_emulation_scene_on_enter(void* context) {
     NfcPlaylistWorker* nfc_worker = nfc_playlist_worker_alloc();
     NfcPlaylistWorker* nfc_worker = nfc_playlist_worker_alloc();
     // Read file
     // Read file
     if(file_stream_open(stream, APP_DATA_PATH("playlist.txt"), FSAM_READ, FSOM_OPEN_EXISTING)) {
     if(file_stream_open(stream, APP_DATA_PATH("playlist.txt"), FSAM_READ, FSOM_OPEN_EXISTING)) {
-        popup_reset(app->popup);
-        popup_set_context(app->popup, app);
-        popup_set_header(app->popup, "Emulating:", 64, 10, AlignCenter, AlignTop);
-        view_dispatcher_switch_to_view(app->view_dispatcher, NfcPlaylistView_Popup);
+        popup_reset(nfc_playlist->popup);
+        popup_set_context(nfc_playlist->popup, nfc_playlist);
+        popup_set_header(nfc_playlist->popup, "Emulating:", 64, 10, AlignCenter, AlignTop);
+        view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Popup);
 
 
         int file_position = 0;
         int file_position = 0;
         // read the file line by line and print the text
         // read the file line by line and print the text
         while(stream_read_line(stream, line)) {
         while(stream_read_line(stream, line)) {
-            if (options_emulate_delay[app->emulate_delay] > 0) {
+            if (options_emulate_delay[nfc_playlist->emulate_delay] > 0) {
                 if (file_position > 0) {
                 if (file_position > 0) {
-                    int time_counter_delay_ms = options_emulate_delay[app->emulate_delay];
+                    int time_counter_delay_ms = options_emulate_delay[nfc_playlist->emulate_delay];
                     do {
                     do {
                         char display_text[30];
                         char display_text[30];
                         snprintf(display_text, 30, "%s\n\n%ds", "Delaying...", (time_counter_delay_ms/1000));
                         snprintf(display_text, 30, "%s\n\n%ds", "Delaying...", (time_counter_delay_ms/1000));
-                        popup_set_text(app->popup, display_text, 64, 25, AlignCenter, AlignTop);
+                        popup_set_text(nfc_playlist->popup, display_text, 64, 25, AlignCenter, AlignTop);
                         furi_delay_ms(500);
                         furi_delay_ms(500);
                         time_counter_delay_ms -= 500;
                         time_counter_delay_ms -= 500;
                     } while(time_counter_delay_ms > 0);
                     } while(time_counter_delay_ms > 0);
@@ -36,7 +36,7 @@ void nfc_playlist_emulation_scene_on_enter(void* context) {
 
 
             char* file_path = (char*)furi_string_get_cstr(line);
             char* file_path = (char*)furi_string_get_cstr(line);
             char* file_name = &strrchr(file_path, '/')[1];
             char* file_name = &strrchr(file_path, '/')[1];
-            int time_counter_ms = options_emulate_timeout[app->emulate_timeout];
+            int time_counter_ms = options_emulate_timeout[nfc_playlist->emulate_timeout];
 
 
             if (storage_file_exists(storage, file_path) == false) {
             if (storage_file_exists(storage, file_path) == false) {
                 char const* popup_text_unformatted = strcat(file_name, "\nnot found");
                 char const* popup_text_unformatted = strcat(file_name, "\nnot found");
@@ -45,7 +45,7 @@ void nfc_playlist_emulation_scene_on_enter(void* context) {
 
 
                 do {
                 do {
                     snprintf(popup_text, popup_text_size, "%s\n%ds", file_name, (time_counter_ms/1000));
                     snprintf(popup_text, popup_text_size, "%s\n%ds", file_name, (time_counter_ms/1000));
-                    popup_set_text(app->popup, popup_text, 64, 25, AlignCenter, AlignTop);
+                    popup_set_text(nfc_playlist->popup, popup_text, 64, 25, AlignCenter, AlignTop);
                     furi_delay_ms(500);
                     furi_delay_ms(500);
                     time_counter_ms -= 500;
                     time_counter_ms -= 500;
                 } while(time_counter_ms > 0);
                 } while(time_counter_ms > 0);
@@ -58,7 +58,7 @@ void nfc_playlist_emulation_scene_on_enter(void* context) {
 
 
                 do {
                 do {
                     snprintf(popup_text, popup_text_size, "%s\n%ds", file_name, (time_counter_ms/1000));
                     snprintf(popup_text, popup_text_size, "%s\n%ds", file_name, (time_counter_ms/1000));
-                    popup_set_text(app->popup, popup_text, 64, 25, AlignCenter, AlignTop);
+                    popup_set_text(nfc_playlist->popup, popup_text, 64, 25, AlignCenter, AlignTop);
                     furi_delay_ms(500);
                     furi_delay_ms(500);
                     time_counter_ms -= 500;
                     time_counter_ms -= 500;
                 } while(nfc_playlist_worker_is_emulating(nfc_worker) && time_counter_ms > 0);
                 } while(nfc_playlist_worker_is_emulating(nfc_worker) && time_counter_ms > 0);
@@ -68,14 +68,14 @@ void nfc_playlist_emulation_scene_on_enter(void* context) {
                 }
                 }
             }
             }
         }
         }
-        popup_reset(app->popup);
-        scene_manager_previous_scene(app->scene_manager);
+        popup_reset(nfc_playlist->popup);
+        scene_manager_previous_scene(nfc_playlist->scene_manager);
     } else {
     } else {
-        popup_reset(app->popup);
-        popup_set_context(app->popup, app);
-        popup_set_header(app->popup, "Error:", 64, 10, AlignCenter, AlignTop);
-        popup_set_text(app->popup, "Failed to open file\n/ext/apps_data/nfc_playlist/playlist.txt", 64, 25, AlignCenter, AlignTop);
-        view_dispatcher_switch_to_view(app->view_dispatcher, NfcPlaylistView_Popup);
+        popup_reset(nfc_playlist->popup);
+        popup_set_context(nfc_playlist->popup, nfc_playlist);
+        popup_set_header(nfc_playlist->popup, "Error:", 64, 10, AlignCenter, AlignTop);
+        popup_set_text(nfc_playlist->popup, "Failed to open file\n/ext/apps_data/nfc_playlist/playlist.txt", 64, 25, AlignCenter, AlignTop);
+        view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Popup);
     }
     }
     // Free/close resources
     // Free/close resources
     furi_string_free(line);
     furi_string_free(line);
@@ -93,6 +93,6 @@ bool nfc_playlist_emulation_scene_on_event(void* context, SceneManagerEvent even
 }
 }
 
 
 void nfc_playlist_emulation_scene_on_exit(void* context) {
 void nfc_playlist_emulation_scene_on_exit(void* context) {
-   NfcPlaylist* app = context;
-   popup_reset(app->popup);
+   NfcPlaylist* nfc_playlist = context;
+   popup_reset(nfc_playlist->popup);
 }
 }

+ 0 - 4
scences/emulation.h

@@ -1,7 +1,5 @@
 #pragma once
 #pragma once
-
 #include <furi.h>
 #include <furi.h>
-#include <string.h>
 #include <storage/storage.h>
 #include <storage/storage.h>
 #include <toolbox/stream/stream.h>
 #include <toolbox/stream/stream.h>
 #include <toolbox/stream/file_stream.h>
 #include <toolbox/stream/file_stream.h>
@@ -10,8 +8,6 @@
 #include <gui/view_dispatcher.h>
 #include <gui/view_dispatcher.h>
 #include <gui/scene_manager.h>
 #include <gui/scene_manager.h>
 #include <gui/modules/popup.h>
 #include <gui/modules/popup.h>
-#include <gui/modules/variable_item_list.h>
-#include <nfc_playlist.h>
 
 
 void nfc_playlist_emulation_scene_on_enter(void* context);
 void nfc_playlist_emulation_scene_on_enter(void* context);
 bool nfc_playlist_emulation_scene_on_event(void* context, SceneManagerEvent event);
 bool nfc_playlist_emulation_scene_on_event(void* context, SceneManagerEvent event);

+ 26 - 23
scences/main_menu.c

@@ -12,10 +12,10 @@ typedef enum {
 } NfcPlaylistMenuSelection;
 } NfcPlaylistMenuSelection;
 
 
 static void nfc_playlist_menu_callback(void* context, uint32_t index) {
 static void nfc_playlist_menu_callback(void* context, uint32_t index) {
-    NfcPlaylist* app = context;
+    NfcPlaylist* nfc_playlist = context;
     switch(index) {
     switch(index) {
         case NfcPlaylistMenuSelection_Start:
         case NfcPlaylistMenuSelection_Start:
-            scene_manager_handle_custom_event(app->scene_manager, NfcPlaylistEvent_ShowEmulatingPopup);
+            scene_manager_handle_custom_event(nfc_playlist->scene_manager, NfcPlaylistEvent_ShowEmulatingPopup);
             break;
             break;
         default:
         default:
             break;
             break;
@@ -23,20 +23,20 @@ static void nfc_playlist_menu_callback(void* context, uint32_t index) {
 }
 }
 
 
 static void nfc_playlist_settings_change_callback(VariableItem* item) {
 static void nfc_playlist_settings_change_callback(VariableItem* item) {
-    NfcPlaylist* app = variable_item_get_context(item);
+    NfcPlaylist* nfc_playlist = variable_item_get_context(item);
 
 
-    uint8_t current_option = variable_item_list_get_selected_item_index(app->variable_item_list);
+    uint8_t current_option = variable_item_list_get_selected_item_index(nfc_playlist->variable_item_list);
     uint8_t option_value_index = variable_item_get_current_value_index(item);
     uint8_t option_value_index = variable_item_get_current_value_index(item);
 
 
     switch(current_option) {
     switch(current_option) {
         case NfcPlaylistSettings_Timeout: ;
         case NfcPlaylistSettings_Timeout: ;
-            app->emulate_timeout = option_value_index;
+            nfc_playlist->emulate_timeout = option_value_index;
             char emulate_timeout_text[10];
             char emulate_timeout_text[10];
             snprintf(emulate_timeout_text, 10, "%ds", (options_emulate_timeout[option_value_index]/1000));
             snprintf(emulate_timeout_text, 10, "%ds", (options_emulate_timeout[option_value_index]/1000));
             variable_item_set_current_value_text(item, (char*)emulate_timeout_text);
             variable_item_set_current_value_text(item, (char*)emulate_timeout_text);
             break;
             break;
         case NfcPlaylistSettings_Delay: ;
         case NfcPlaylistSettings_Delay: ;
-            app->emulate_delay = option_value_index;
+            nfc_playlist->emulate_delay = option_value_index;
             char emulate_delay_text[10];
             char emulate_delay_text[10];
             snprintf(emulate_delay_text, 10, "%ds", (options_emulate_delay[option_value_index]/1000));
             snprintf(emulate_delay_text, 10, "%ds", (options_emulate_delay[option_value_index]/1000));
             variable_item_set_current_value_text(item, (char*)emulate_delay_text);
             variable_item_set_current_value_text(item, (char*)emulate_delay_text);
@@ -47,41 +47,44 @@ static void nfc_playlist_settings_change_callback(VariableItem* item) {
 }
 }
 
 
 void nfc_playlist_main_menu_scene_on_enter(void* context) {
 void nfc_playlist_main_menu_scene_on_enter(void* context) {
-    NfcPlaylist* app = context;
-    variable_item_list_set_header(app->variable_item_list, "NFC Playlist");
+    NfcPlaylist* nfc_playlist = context;
+    variable_item_list_set_header(nfc_playlist->variable_item_list, "NFC Playlist");
+
     VariableItem* emulation_timeout_settings = variable_item_list_add(
     VariableItem* emulation_timeout_settings = variable_item_list_add(
-        app->variable_item_list,
+        nfc_playlist->variable_item_list,
         "Timeout",
         "Timeout",
         10,
         10,
         nfc_playlist_settings_change_callback,
         nfc_playlist_settings_change_callback,
-        app);
-    variable_item_set_current_value_index(emulation_timeout_settings, app->emulate_timeout);
+        nfc_playlist);
+    variable_item_set_current_value_index(emulation_timeout_settings, nfc_playlist->emulate_timeout);
     char emulation_timeout_settings_text[10];
     char emulation_timeout_settings_text[10];
-    snprintf(emulation_timeout_settings_text, 10, "%ds", (options_emulate_timeout[app->emulate_timeout]/1000));
+    snprintf(emulation_timeout_settings_text, 10, "%ds", (options_emulate_timeout[nfc_playlist->emulate_timeout]/1000));
     variable_item_set_current_value_text(emulation_timeout_settings, (char*)emulation_timeout_settings_text);
     variable_item_set_current_value_text(emulation_timeout_settings, (char*)emulation_timeout_settings_text);
+
     VariableItem* emulation_delay_settings = variable_item_list_add(
     VariableItem* emulation_delay_settings = variable_item_list_add(
-        app->variable_item_list,
+        nfc_playlist->variable_item_list,
         "Delay",
         "Delay",
         6,
         6,
         nfc_playlist_settings_change_callback,
         nfc_playlist_settings_change_callback,
-        app);
-    variable_item_set_current_value_index(emulation_delay_settings, app->emulate_delay);
+        nfc_playlist);
+    variable_item_set_current_value_index(emulation_delay_settings, nfc_playlist->emulate_delay);
     char emulation_delay_settings_text[10];
     char emulation_delay_settings_text[10];
-    snprintf(emulation_delay_settings_text, 10, "%ds", (options_emulate_delay[app->emulate_delay]/1000));
+    snprintf(emulation_delay_settings_text, 10, "%ds", (options_emulate_delay[nfc_playlist->emulate_delay]/1000));
     variable_item_set_current_value_text(emulation_delay_settings, (char*)emulation_delay_settings_text);
     variable_item_set_current_value_text(emulation_delay_settings, (char*)emulation_delay_settings_text);
-    variable_item_list_add(app->variable_item_list, "Start", 0, NULL, NULL);
-    variable_item_list_set_enter_callback(app->variable_item_list, nfc_playlist_menu_callback, app);
-    view_dispatcher_switch_to_view(app->view_dispatcher, NfcPlaylistView_Menu);
+
+    variable_item_list_add(nfc_playlist->variable_item_list, "Start", 0, NULL, NULL);
+    variable_item_list_set_enter_callback(nfc_playlist->variable_item_list, nfc_playlist_menu_callback, nfc_playlist);
+    view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Menu);
 }
 }
 
 
 bool nfc_playlist_main_menu_scene_on_event(void* context, SceneManagerEvent event) {
 bool nfc_playlist_main_menu_scene_on_event(void* context, SceneManagerEvent event) {
-    NfcPlaylist* app = context;
+    NfcPlaylist* nfc_playlist = context;
     bool consumed = false;
     bool consumed = false;
     switch(event.type) {
     switch(event.type) {
         case SceneManagerEventTypeCustom:
         case SceneManagerEventTypeCustom:
             switch(event.event) {
             switch(event.event) {
                 case NfcPlaylistEvent_ShowEmulatingPopup:
                 case NfcPlaylistEvent_ShowEmulatingPopup:
-                    scene_manager_next_scene(app->scene_manager, NfcPlaylistScene_EmulatingPopup);
+                    scene_manager_next_scene(nfc_playlist->scene_manager, NfcPlaylistScene_EmulatingPopup);
                     consumed = true;
                     consumed = true;
                     break;
                     break;
                 default:
                 default:
@@ -96,6 +99,6 @@ bool nfc_playlist_main_menu_scene_on_event(void* context, SceneManagerEvent even
 }
 }
 
 
 void nfc_playlist_main_menu_scene_on_exit(void* context) {
 void nfc_playlist_main_menu_scene_on_exit(void* context) {
-   NfcPlaylist* app = context;
-   variable_item_list_reset(app->variable_item_list);
+   NfcPlaylist* nfc_playlist = context;
+   variable_item_list_reset(nfc_playlist->variable_item_list);
 }
 }

+ 0 - 4
scences/main_menu.h

@@ -1,12 +1,8 @@
 #pragma once
 #pragma once
-
 #include <furi.h>
 #include <furi.h>
-#include <string.h>
-
 #include <gui/gui.h>
 #include <gui/gui.h>
 #include <gui/view_dispatcher.h>
 #include <gui/view_dispatcher.h>
 #include <gui/scene_manager.h>
 #include <gui/scene_manager.h>
-#include <gui/modules/popup.h>
 #include <gui/modules/variable_item_list.h>
 #include <gui/modules/variable_item_list.h>
 
 
 void nfc_playlist_main_menu_scene_on_enter(void* context);
 void nfc_playlist_main_menu_scene_on_enter(void* context);