Skip to content

Commit c65c6e7

Browse files
committed
More fixes
- Adds the fix from the renaming function to the create function
1 parent 7c93057 commit c65c6e7

File tree

5 files changed

+26
-8
lines changed

5 files changed

+26
-8
lines changed

application.fam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ App(
88
fap_category="NFC",
99
fap_author="@acegoal07",
1010
fap_weburl="https://github.com/acegoal07/FlipperZero_NFC_Playlist/tree/main",
11-
fap_version="2.1",
11+
fap_version="2.2",
1212
fap_icon="assets/icon.png",
1313
fap_private_libs=[
1414
Lib(

lib/emulation_worker/nfc_playlist_emulation_worker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
NfcPlaylistEmulationWorker* nfc_playlist_emulation_worker_alloc() {
44
NfcPlaylistEmulationWorker* nfc_playlist_emulation_worker = malloc(sizeof(NfcPlaylistEmulationWorker));
5-
nfc_playlist_emulation_worker->thread = furi_thread_alloc_ex("NfcPlaylistEmulationWorker", 8192, nfc_playlist_emulation_worker_task, nfc_playlist_emulation_worker);
5+
nfc_playlist_emulation_worker->thread = furi_thread_alloc_ex("NfcPlaylistEmulationWorker", 4096, nfc_playlist_emulation_worker_task, nfc_playlist_emulation_worker);
66
nfc_playlist_emulation_worker->state = NfcPlaylistEmulationWorkerState_Stopped;
77
nfc_playlist_emulation_worker->nfc = nfc_alloc();
88
nfc_playlist_emulation_worker->nfc_device = nfc_device_alloc();

scenes/nfc_playlist_scene_emulation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ int32_t nfc_playlist_emulation_task(void* context) {
134134

135135
void nfc_playlist_emulation_setup(void* context) {
136136
NfcPlaylist* nfc_playlist = context;
137-
nfc_playlist->thread = furi_thread_alloc_ex("NfcPlaylistEmulationWorker", 8192, nfc_playlist_emulation_task, nfc_playlist);
137+
nfc_playlist->thread = furi_thread_alloc_ex("NfcPlaylistEmulationWorker", 4096, nfc_playlist_emulation_task, nfc_playlist);
138138
nfc_playlist->nfc_playlist_emulation_worker = nfc_playlist_emulation_worker_alloc();
139139
}
140140

scenes/nfc_playlist_scene_name_new_playlist.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "../nfc_playlist.h"
22

3-
void nfc_playlist_name_new_playlist_menu_callback(void* context) {
3+
int32_t nfc_playlist_name_new_playlist_thread_task(void* context) {
44
NfcPlaylist* nfc_playlist = context;
55

66
FuriString* file_name = furi_string_alloc_printf("/ext/apps_data/nfc_playlist/%s.txt", nfc_playlist->text_input_output);
@@ -20,7 +20,25 @@ void nfc_playlist_name_new_playlist_menu_callback(void* context) {
2020
furi_string_free(file_name);
2121
storage_file_free(file);
2222
furi_record_close(RECORD_STORAGE);
23-
scene_manager_previous_scene(nfc_playlist->scene_manager);
23+
24+
return 0;
25+
}
26+
27+
void nfc_playlist_name_new_playlist_thread_state_callback(FuriThreadState state, void* context) {
28+
NfcPlaylist* nfc_playlist = context;
29+
if(state == FuriThreadStateStopped) {
30+
furi_thread_yield();
31+
nfc_playlist->thread = NULL;
32+
scene_manager_search_and_switch_to_previous_scene(nfc_playlist->scene_manager, NfcPlaylistScene_MainMenu);
33+
}
34+
}
35+
36+
void nfc_playlist_name_new_playlist_menu_callback(void* context) {
37+
NfcPlaylist* nfc_playlist = context;
38+
nfc_playlist->thread = furi_thread_alloc_ex("NfcPlaylistCreator", 1024, nfc_playlist_name_new_playlist_thread_task, nfc_playlist);
39+
furi_thread_set_state_context(nfc_playlist->thread, nfc_playlist);
40+
furi_thread_set_state_callback(nfc_playlist->thread, nfc_playlist_name_new_playlist_thread_state_callback);
41+
furi_thread_start(nfc_playlist->thread);
2442
}
2543

2644
void nfc_playlist_name_new_playlist_scene_on_enter(void* context) {
@@ -29,7 +47,7 @@ void nfc_playlist_name_new_playlist_scene_on_enter(void* context) {
2947
nfc_playlist->text_input_output = malloc(MAX_PLAYLIST_NAME_LEN + 1);
3048
text_input_set_header_text(nfc_playlist->text_input, "Enter file name");
3149
text_input_set_minimum_length(nfc_playlist->text_input, 1);
32-
text_input_set_result_callback(nfc_playlist->text_input, nfc_playlist_name_new_playlist_menu_callback, nfc_playlist, nfc_playlist->text_input_output, MAX_PLAYLIST_NAME_LEN, false);
50+
text_input_set_result_callback(nfc_playlist->text_input, nfc_playlist_name_new_playlist_menu_callback, nfc_playlist, nfc_playlist->text_input_output, MAX_PLAYLIST_NAME_LEN, true);
3351

3452
view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_TextInput);
3553
}

scenes/nfc_playlist_scene_playlist_rename.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ int32_t nfc_playlist_playlist_rename_thread_task(void* context) {
2424

2525
void nfc_playlist_playlist_rename_thread_state_callback(FuriThreadState state, void* context) {
2626
NfcPlaylist* nfc_playlist = context;
27-
UNUSED(nfc_playlist);
2827
if(state == FuriThreadStateStopped) {
2928
furi_thread_yield();
29+
nfc_playlist->thread = NULL;
3030
scene_manager_search_and_switch_to_previous_scene(nfc_playlist->scene_manager, NfcPlaylistScene_MainMenu);
3131
}
3232
}
3333

3434
void nfc_playlist_playlist_rename_menu_callback(void* context) {
3535
NfcPlaylist* nfc_playlist = context;
36-
nfc_playlist->thread = furi_thread_alloc_ex("NfcPlaylistRenamer", 8192, nfc_playlist_playlist_rename_thread_task, nfc_playlist);
36+
nfc_playlist->thread = furi_thread_alloc_ex("NfcPlaylistRenamer", 1024, nfc_playlist_playlist_rename_thread_task, nfc_playlist);
3737
furi_thread_set_state_context(nfc_playlist->thread, nfc_playlist);
3838
furi_thread_set_state_callback(nfc_playlist->thread, nfc_playlist_playlist_rename_thread_state_callback);
3939
furi_thread_start(nfc_playlist->thread);

0 commit comments

Comments
 (0)