Skip to content

Commit

Permalink
use non prefixed names for regular files with random name
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Mar 15, 2024
1 parent f88da8b commit ce67472
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion applications/main/ibutton/scenes/ibutton_scene_save_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void ibutton_scene_save_name_on_enter(void* context) {
const bool is_new_file = furi_string_empty(ibutton->file_path);

if(is_new_file) {
name_generator_make_auto(
name_generator_make_auto_basic(
ibutton->key_name, IBUTTON_KEY_NAME_SIZE, IBUTTON_APP_FILENAME_PREFIX);
}

Expand Down
2 changes: 1 addition & 1 deletion applications/main/lfrfid/scenes/lfrfid_scene_save_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void lfrfid_scene_save_name_on_enter(void* context) {
if(key_name_is_empty) {
furi_string_set(app->file_path, LFRFID_APP_FOLDER);

name_generator_make_auto(
name_generator_make_auto_basic(
app->text_store, LFRFID_TEXT_STORE_SIZE, LFRFID_APP_FILENAME_PREFIX);

furi_string_set(folder_path, LFRFID_APP_FOLDER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ static void nfc_protocol_support_scene_save_name_on_enter(NfcApp* instance) {
bool name_is_empty = furi_string_empty(instance->file_name);
if(name_is_empty) {
furi_string_set(instance->file_path, NFC_APP_FOLDER);
name_generator_make_auto(
name_generator_make_auto_basic(
instance->text_store, NFC_TEXT_STORE_SIZE, NFC_APP_FILENAME_PREFIX);
furi_string_set(folder_path, NFC_APP_FOLDER);
} else {
Expand Down
8 changes: 8 additions & 0 deletions lib/toolbox/name_generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ void name_generator_make_auto(char* name, size_t max_name_size, const char* pref
name_generator_make_auto_datetime(name, max_name_size, prefix, NULL);
}

void name_generator_make_auto_basic(char* name, size_t max_name_size, const char* prefix) {
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDetailedFilename)) {
name_generator_make_detailed_datetime(name, max_name_size, prefix, NULL);
} else {
name_generator_make_random(name, max_name_size);
}
}

void name_generator_make_random_prefixed(char* name, size_t max_name_size, const char* prefix) {
furi_assert(name);
furi_assert(max_name_size);
Expand Down
3 changes: 3 additions & 0 deletions lib/toolbox/name_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ void name_generator_make_auto_datetime(
const char* prefix,
DateTime* custom_time);

// Generate name without prefix in random names
void name_generator_make_auto_basic(char* name, size_t max_name_size, const char* prefix);

/** Generates random name
*
* @param name buffer to write random name
Expand Down
1 change: 1 addition & 0 deletions targets/f7/api_symbols.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2645,6 +2645,7 @@ Function,-,music_worker_set_volume,void,"MusicWorker*, float"
Function,-,music_worker_start,void,MusicWorker*
Function,-,music_worker_stop,void,MusicWorker*
Function,+,name_generator_make_auto,void,"char*, size_t, const char*"
Function,+,name_generator_make_auto_basic,void,"char*, size_t, const char*"
Function,+,name_generator_make_auto_datetime,void,"char*, size_t, const char*, DateTime*"
Function,+,name_generator_make_detailed,void,"char*, size_t, const char*"
Function,+,name_generator_make_detailed_datetime,void,"char*, size_t, const char*, DateTime*"
Expand Down

0 comments on commit ce67472

Please sign in to comment.