mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Dynamic default nfc naming
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -2196,6 +2196,7 @@ Function,+,nfc_device_delete,_Bool,"NfcDevice*, _Bool"
|
||||
Function,+,nfc_device_free,void,NfcDevice*
|
||||
Function,+,nfc_device_load,_Bool,"NfcDevice*, const char*, _Bool"
|
||||
Function,+,nfc_device_load_key_cache,_Bool,NfcDevice*
|
||||
Function,+,nfc_device_prepare_format_string,void,"NfcDevice*, FuriString*"
|
||||
Function,+,nfc_device_restore,_Bool,"NfcDevice*, _Bool"
|
||||
Function,+,nfc_device_save,_Bool,"NfcDevice*, const char*"
|
||||
Function,+,nfc_device_save_shadow,_Bool,"NfcDevice*, const char*"
|
||||
|
||||
|
@@ -47,7 +47,7 @@ void nfc_device_free(NfcDevice* nfc_dev) {
|
||||
free(nfc_dev);
|
||||
}
|
||||
|
||||
static void nfc_device_prepare_format_string(NfcDevice* dev, FuriString* format_string) {
|
||||
void nfc_device_prepare_format_string(NfcDevice* dev, FuriString* format_string) {
|
||||
if(dev->format == NfcDeviceSaveFormatUid) {
|
||||
furi_string_set(format_string, "UID");
|
||||
} else if(dev->format == NfcDeviceSaveFormatBankCard) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NFC_DEV_NAME_MAX_LEN 22
|
||||
#define NFC_DEV_NAME_MAX_LEN 31
|
||||
#define NFC_READER_DATA_MAX_SIZE 64
|
||||
#define NFC_DICT_KEY_BATCH_SIZE 10
|
||||
|
||||
@@ -123,6 +123,8 @@ bool nfc_device_restore(NfcDevice* dev, bool use_load_path);
|
||||
|
||||
void nfc_device_set_loading_callback(NfcDevice* dev, NfcLoadingCallback callback, void* context);
|
||||
|
||||
void nfc_device_prepare_format_string(NfcDevice* dev, FuriString* format_string);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user