mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 03:28:36 -07:00
Port new naming scheme to apps
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#include <lib/toolbox/random_name.h>
|
#include <toolbox/name_generator.h>
|
||||||
#include "../mag_i.h"
|
#include "../mag_i.h"
|
||||||
|
|
||||||
void mag_scene_input_name_on_enter(void* context) {
|
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) {
|
if(name_is_empty) {
|
||||||
furi_string_set(mag->file_path, MAG_APP_FOLDER);
|
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);
|
furi_string_set(folder_path, MAG_APP_FOLDER);
|
||||||
} else {
|
} else {
|
||||||
// TODO: compatible types etc
|
// TODO: compatible types etc
|
||||||
|
|||||||
2
applications/external/multi_fuzzer/fuzzer.c
vendored
2
applications/external/multi_fuzzer/fuzzer.c
vendored
@@ -140,6 +140,7 @@ int32_t fuzzer_start_ibtn(void* p) {
|
|||||||
.key_extension = ".ibtn",
|
.key_extension = ".ibtn",
|
||||||
.path_key_folder = EXT_PATH("ibutton"),
|
.path_key_folder = EXT_PATH("ibutton"),
|
||||||
.key_icon = &I_ibutt_10px,
|
.key_icon = &I_ibutt_10px,
|
||||||
|
.file_prefix = "iBtn",
|
||||||
};
|
};
|
||||||
fuzzer_app->fuzzer_const = &app_const;
|
fuzzer_app->fuzzer_const = &app_const;
|
||||||
|
|
||||||
@@ -159,6 +160,7 @@ int32_t fuzzer_start_rfid(void* p) {
|
|||||||
.key_extension = ".rfid",
|
.key_extension = ".rfid",
|
||||||
.path_key_folder = EXT_PATH("lfrfid"),
|
.path_key_folder = EXT_PATH("lfrfid"),
|
||||||
.key_icon = &I_125_10px,
|
.key_icon = &I_125_10px,
|
||||||
|
.file_prefix = "RFID",
|
||||||
};
|
};
|
||||||
fuzzer_app->fuzzer_const = &app_const;
|
fuzzer_app->fuzzer_const = &app_const;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ typedef struct {
|
|||||||
const char* key_extension;
|
const char* key_extension;
|
||||||
const char* path_key_folder;
|
const char* path_key_folder;
|
||||||
const Icon* key_icon;
|
const Icon* key_icon;
|
||||||
|
const char* file_prefix;
|
||||||
} FuzzerConsts;
|
} FuzzerConsts;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "../fuzzer_i.h"
|
#include "../fuzzer_i.h"
|
||||||
|
|
||||||
#include <toolbox/random_name.h>
|
#include <toolbox/name_generator.h>
|
||||||
#include <toolbox/path.h>
|
#include <toolbox/path.h>
|
||||||
|
|
||||||
static void fuzzer_scene_save_name_text_input_callback(void* context) {
|
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;
|
PacsFuzzerApp* app = context;
|
||||||
TextInput* text_input = app->text_input;
|
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_header_text(text_input, "Name the key");
|
||||||
text_input_set_result_callback(
|
text_input_set_result_callback(
|
||||||
@@ -21,7 +21,7 @@ void fuzzer_scene_save_name_on_enter(void* context) {
|
|||||||
app,
|
app,
|
||||||
app->key_name,
|
app->key_name,
|
||||||
KEY_NAME_SIZE,
|
KEY_NAME_SIZE,
|
||||||
false);
|
true);
|
||||||
|
|
||||||
ValidatorIsFile* validator_is_file = validator_is_file_alloc_init(
|
ValidatorIsFile* validator_is_file = validator_is_file_alloc_init(
|
||||||
app->fuzzer_const->path_key_folder, app->fuzzer_const->key_extension, app->key_name);
|
app->fuzzer_const->path_key_folder, app->fuzzer_const->key_extension, app->key_name);
|
||||||
|
|||||||
2
applications/external/nfc_maker/nfc_maker.h
vendored
2
applications/external/nfc_maker/nfc_maker.h
vendored
@@ -13,7 +13,7 @@
|
|||||||
#include <gui/modules/popup.h>
|
#include <gui/modules/popup.h>
|
||||||
#include "scenes/nfc_maker_scene.h"
|
#include "scenes/nfc_maker_scene.h"
|
||||||
#include <lib/flipper_format/flipper_format.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 <applications/main/nfc/nfc_i.h>
|
||||||
#include <furi_hal_bt.h>
|
#include <furi_hal_bt.h>
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ void nfc_maker_scene_save_on_enter(void* context) {
|
|||||||
|
|
||||||
text_input_set_header_text(text_input, "Save the NFC tag:");
|
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_set_result_callback(
|
||||||
text_input,
|
text_input,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "../picopass_i.h"
|
#include "../picopass_i.h"
|
||||||
#include <lib/toolbox/random_name.h>
|
|
||||||
#include <gui/modules/validators.h>
|
#include <gui/modules/validators.h>
|
||||||
#include <toolbox/path.h>
|
#include <toolbox/path.h>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "../picopass_i.h"
|
#include "../picopass_i.h"
|
||||||
#include <lib/toolbox/random_name.h>
|
#include <toolbox/name_generator.h>
|
||||||
#include <gui/modules/validators.h>
|
#include <gui/modules/validators.h>
|
||||||
#include <toolbox/path.h>
|
#include <toolbox/path.h>
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ void picopass_scene_save_name_on_enter(void* context) {
|
|||||||
TextInput* text_input = picopass->text_input;
|
TextInput* text_input = picopass->text_input;
|
||||||
bool dev_name_empty = false;
|
bool dev_name_empty = false;
|
||||||
if(!strcmp(picopass->dev->dev_name, "")) {
|
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;
|
dev_name_empty = true;
|
||||||
} else {
|
} else {
|
||||||
picopass_text_store_set(picopass, picopass->dev->dev_name);
|
picopass_text_store_set(picopass, picopass->dev->dev_name);
|
||||||
|
|||||||
9
applications/external/protoview/view_info.c
vendored
9
applications/external/protoview/view_info.c
vendored
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include <gui/view.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
|
/* This view has subviews accessible navigating up/down. This
|
||||||
* enumaration is used to track the currently active subview. */
|
* 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. */
|
/* Set a random filename the user can edit. */
|
||||||
void set_signal_random_filename(ProtoViewApp* app, char* buf, size_t buflen) {
|
void set_signal_random_filename(ProtoViewApp* app, char* buf, size_t buflen) {
|
||||||
char suffix[6];
|
name_generator_make_auto(buf, buflen, app->msg_info->decoder->name);
|
||||||
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, '/', '_');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== Signal transmission =========================== */
|
/* ========================== Signal transmission =========================== */
|
||||||
|
|||||||
@@ -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, '/');
|
size_t filename_start = furi_string_search_rchar(app->file_path, '/');
|
||||||
furi_string_left(app->file_path, filename_start);
|
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) {
|
void spi_mem_scene_read_filename_on_enter(void* context) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include <gui/modules/text_input.h>
|
#include <gui/modules/text_input.h>
|
||||||
#include <storage/storage.h>
|
#include <storage/storage.h>
|
||||||
#include <toolbox/path.h>
|
#include <toolbox/path.h>
|
||||||
#include <toolbox/random_name.h>
|
#include <toolbox/name_generator.h>
|
||||||
#include "scenes/spi_mem_scene.h"
|
#include "scenes/spi_mem_scene.h"
|
||||||
#include "lib/spi/spi_mem_worker.h"
|
#include "lib/spi/spi_mem_worker.h"
|
||||||
#include "spi_mem_manager_icons.h"
|
#include "spi_mem_manager_icons.h"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "../subbrute_i.h"
|
#include "../subbrute_i.h"
|
||||||
#include "subbrute_scene.h"
|
#include "subbrute_scene.h"
|
||||||
#include <lib/toolbox/random_name.h>
|
#include <toolbox/name_generator.h>
|
||||||
|
|
||||||
#define TAG "SubBruteSceneSaveFile"
|
#define TAG "SubBruteSceneSaveFile"
|
||||||
|
|
||||||
@@ -9,7 +9,10 @@ void subbrute_scene_save_name_on_enter(void* context) {
|
|||||||
|
|
||||||
// Setup view
|
// Setup view
|
||||||
TextInput* text_input = instance->text_input;
|
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_header_text(text_input, "Name of file");
|
||||||
text_input_set_result_callback(
|
text_input_set_result_callback(
|
||||||
|
|||||||
Reference in New Issue
Block a user