Skip to content

Commit 0107074

Browse files
committed
Rename playlist 1
1 parent 9154d45 commit 0107074

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ All the playlists should be placed in ext/apps_data/nfc_playlist and an example
1212
An example file can be found in the repository
1313

1414
## How to build
15-
This app was design, built and tested using the <a href="https://github.com/Flipper-XFW/Xtreme-Firmware">Xtreme firmware</a> i don't see why it wont work with other firmwares but do keep this in mind when building it with FBT/uFBT
15+
This app was design, built and tested using the <a href="https://github.com/Flipper-XFW/Xtreme-Firmware">Xtreme firmware</a> so keep that in mind when building the FAP for yourself
1616

17-
## Ideas
18-
- [X] Add the ability to change playlist
19-
- [ ] Make it so changed settings are saved (maybe make it so settings can be specified for each playlist changing the settings based on the playlist selected)
17+
## Known Issues
18+
- A weird crash after renaming a playlist multiple times

scences/file_edit.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,23 @@ void nfc_playlist_file_edit_scene_on_enter(void* context) {
3737

3838
submenu_set_header(nfc_playlist->submenu, "Edit Playlist");
3939

40-
submenu_add_item(
40+
submenu_add_lockable_item(
4141
nfc_playlist->submenu,
4242
"Delete Playlist",
4343
NfcPlaylistMenuSelection_DeletePlaylist,
4444
nfc_playlist_file_edit_menu_callback,
45-
nfc_playlist);
45+
nfc_playlist,
46+
!nfc_playlist->file_selected_check,
47+
"Playlist\nNot\nSelected");
4648

4749
submenu_add_lockable_item(
4850
nfc_playlist->submenu,
4951
"Rename Playlist",
5052
NfcPlaylistMenuSelection_RenamePlaylist,
5153
nfc_playlist_file_edit_menu_callback,
5254
nfc_playlist,
53-
true,
54-
"Under construction");
55+
!nfc_playlist->file_selected_check,
56+
"Playlist\nNot\nSelected");
5557

5658
view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_FileEdit);
5759
}

scences/text_input.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@
33

44
void nfc_playlist_text_input_menu_callback(void* context) {
55
NfcPlaylist* nfc_playlist = context;
6+
Storage* storage = furi_record_open(RECORD_STORAGE);
7+
8+
char path[29] = "/ext/apps_data/nfc_playlist/";
9+
int size = (sizeof(nfc_playlist->text_input_data) + sizeof(".txt") + sizeof(path));
10+
char new_file_name[size];
11+
snprintf(new_file_name, size, "%s%s%s", path, nfc_playlist->text_input_data, ".txt");
12+
storage_common_rename(storage, furi_string_get_cstr(nfc_playlist->file_path), new_file_name);
13+
14+
furi_record_close(RECORD_STORAGE);
15+
nfc_playlist->file_path = furi_string_alloc_set_str(new_file_name);
616
scene_manager_previous_scene(nfc_playlist->scene_manager);
717
}
818

919
void nfc_playlist_text_input_scene_on_enter(void* context) {
1020
NfcPlaylist* nfc_playlist = context;
11-
1221
text_input_set_header_text(nfc_playlist->text_input, "Enter new file name");
1322
text_input_set_minimum_length(nfc_playlist->text_input, 1);
1423
text_input_set_result_callback(nfc_playlist->text_input, nfc_playlist_text_input_menu_callback, nfc_playlist, nfc_playlist->text_input_data, 50, true);

scences/text_input.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22
#include <furi.h>
3+
#include <string.h>
34
#include <gui/gui.h>
45
#include <gui/view_dispatcher.h>
56
#include <gui/scene_manager.h>

0 commit comments

Comments
 (0)