Port new naming scheme to apps

This commit is contained in:
Willy-JL
2023-09-02 17:16:21 +02:00
parent 6d8ef70f28
commit 58355994ec
12 changed files with 21 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
#include <lib/toolbox/random_name.h>
#include <toolbox/name_generator.h>
#include "../mag_i.h"
void mag_scene_input_name_on_enter(void* context) {
@@ -13,7 +13,7 @@ void mag_scene_input_name_on_enter(void* context) {
if(name_is_empty) {
furi_string_set(mag->file_path, MAG_APP_FOLDER);
set_random_name(mag->text_store, MAG_TEXT_STORE_SIZE);
name_generator_make_auto(mag->text_store, MAG_TEXT_STORE_SIZE, "Mag");
furi_string_set(folder_path, MAG_APP_FOLDER);
} else {
// TODO: compatible types etc

View File

@@ -140,6 +140,7 @@ int32_t fuzzer_start_ibtn(void* p) {
.key_extension = ".ibtn",
.path_key_folder = EXT_PATH("ibutton"),
.key_icon = &I_ibutt_10px,
.file_prefix = "iBtn",
};
fuzzer_app->fuzzer_const = &app_const;
@@ -159,6 +160,7 @@ int32_t fuzzer_start_rfid(void* p) {
.key_extension = ".rfid",
.path_key_folder = EXT_PATH("lfrfid"),
.key_icon = &I_125_10px,
.file_prefix = "RFID",
};
fuzzer_app->fuzzer_const = &app_const;

View File

@@ -33,6 +33,7 @@ typedef struct {
const char* key_extension;
const char* path_key_folder;
const Icon* key_icon;
const char* file_prefix;
} FuzzerConsts;
typedef struct {

View File

@@ -1,6 +1,6 @@
#include "../fuzzer_i.h"
#include <toolbox/random_name.h>
#include <toolbox/name_generator.h>
#include <toolbox/path.h>
static void fuzzer_scene_save_name_text_input_callback(void* context) {
@@ -12,7 +12,7 @@ void fuzzer_scene_save_name_on_enter(void* context) {
PacsFuzzerApp* app = context;
TextInput* text_input = app->text_input;
set_random_name(app->key_name, KEY_NAME_SIZE);
name_generator_make_auto(app->key_name, KEY_NAME_SIZE, app->fuzzer_const->file_prefix);
text_input_set_header_text(text_input, "Name the key");
text_input_set_result_callback(
@@ -21,7 +21,7 @@ void fuzzer_scene_save_name_on_enter(void* context) {
app,
app->key_name,
KEY_NAME_SIZE,
false);
true);
ValidatorIsFile* validator_is_file = validator_is_file_alloc_init(
app->fuzzer_const->path_key_folder, app->fuzzer_const->key_extension, app->key_name);

View File

@@ -13,7 +13,7 @@
#include <gui/modules/popup.h>
#include "scenes/nfc_maker_scene.h"
#include <lib/flipper_format/flipper_format.h>
#include <lib/toolbox/random_name.h>
#include <toolbox/name_generator.h>
#include <applications/main/nfc/nfc_i.h>
#include <furi_hal_bt.h>

View File

@@ -16,7 +16,7 @@ void nfc_maker_scene_save_on_enter(void* context) {
text_input_set_header_text(text_input, "Save the NFC tag:");
set_random_name(app->save_buf, BIG_INPUT_LEN);
name_generator_make_auto(app->save_buf, BIG_INPUT_LEN, "NFC");
text_input_set_result_callback(
text_input,

View File

@@ -1,5 +1,4 @@
#include "../picopass_i.h"
#include <lib/toolbox/random_name.h>
#include <gui/modules/validators.h>
#include <toolbox/path.h>

View File

@@ -1,5 +1,5 @@
#include "../picopass_i.h"
#include <lib/toolbox/random_name.h>
#include <toolbox/name_generator.h>
#include <gui/modules/validators.h>
#include <toolbox/path.h>
@@ -16,7 +16,7 @@ void picopass_scene_save_name_on_enter(void* context) {
TextInput* text_input = picopass->text_input;
bool dev_name_empty = false;
if(!strcmp(picopass->dev->dev_name, "")) {
set_random_name(picopass->text_store, sizeof(picopass->text_store));
name_generator_make_auto(picopass->text_store, sizeof(picopass->text_store), "PicoPass");
dev_name_empty = true;
} else {
picopass_text_store_set(picopass, picopass->dev->dev_name);

View File

@@ -3,7 +3,7 @@
#include "app.h"
#include <gui/view.h>
#include <lib/toolbox/random_name.h>
#include <toolbox/name_generator.h>
/* This view has subviews accessible navigating up/down. This
* enumaration is used to track the currently active subview. */
@@ -166,12 +166,7 @@ void str_replace(char* buf, char c1, char c2) {
/* Set a random filename the user can edit. */
void set_signal_random_filename(ProtoViewApp* app, char* buf, size_t buflen) {
char suffix[6];
set_random_name(suffix, sizeof(suffix));
snprintf(buf, buflen, "%.10s-%s-%d", app->msg_info->decoder->name, suffix, rand() % 1000);
str_replace(buf, ' ', '_');
str_replace(buf, '-', '_');
str_replace(buf, '/', '_');
name_generator_make_auto(buf, buflen, app->msg_info->decoder->name);
}
/* ========================== Signal transmission =========================== */

View File

@@ -11,7 +11,7 @@ void spi_mem_scene_read_set_random_filename(SPIMemApp* app) {
size_t filename_start = furi_string_search_rchar(app->file_path, '/');
furi_string_left(app->file_path, filename_start);
}
set_random_name(app->text_buffer, SPI_MEM_TEXT_BUFFER_SIZE);
name_generator_make_auto(app->text_buffer, SPI_MEM_TEXT_BUFFER_SIZE, TAG);
}
void spi_mem_scene_read_filename_on_enter(void* context) {

View File

@@ -15,7 +15,7 @@
#include <gui/modules/text_input.h>
#include <storage/storage.h>
#include <toolbox/path.h>
#include <toolbox/random_name.h>
#include <toolbox/name_generator.h>
#include "scenes/spi_mem_scene.h"
#include "lib/spi/spi_mem_worker.h"
#include "spi_mem_manager_icons.h"

View File

@@ -1,6 +1,6 @@
#include "../subbrute_i.h"
#include "subbrute_scene.h"
#include <lib/toolbox/random_name.h>
#include <toolbox/name_generator.h>
#define TAG "SubBruteSceneSaveFile"
@@ -9,7 +9,10 @@ void subbrute_scene_save_name_on_enter(void* context) {
// Setup view
TextInput* text_input = instance->text_input;
set_random_name(instance->text_store, sizeof(instance->text_store));
name_generator_make_auto(
instance->text_store,
sizeof(instance->text_store),
subbrute_protocol_file(instance->device->protocol_info->file));
text_input_set_header_text(text_input, "Name of file");
text_input_set_result_callback(