Dynamic default nfc naming

This commit is contained in:
Willy-JL
2023-09-02 22:18:42 +02:00
parent 6caf8a6432
commit 8443fc53f2
4 changed files with 15 additions and 3 deletions

View File

@@ -17,7 +17,16 @@ void nfc_scene_save_name_on_enter(void* context) {
TextInput* text_input = nfc->text_input;
bool dev_name_empty = false;
if(!strcmp(nfc->dev->dev_name, "")) {
name_generator_make_auto(nfc->text_store, NFC_DEV_NAME_MAX_LEN, NFC_APP_FILENAME_PREFIX);
FuriString* prefix = furi_string_alloc();
nfc_device_prepare_format_string(nfc->dev, prefix);
furi_string_replace(prefix, "Mifare", "MF");
furi_string_replace(prefix, "Ultralight", "UL");
furi_string_replace(prefix, " Plus", "+");
furi_string_replace_all(prefix, " ", "_");
furi_string_left(prefix, 12);
name_generator_make_auto(
nfc->text_store, NFC_DEV_NAME_MAX_LEN, furi_string_get_cstr(prefix));
furi_string_free(prefix);
dev_name_empty = true;
} else {
nfc_text_store_set(nfc, nfc->dev->dev_name);