mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 15:48:35 -07:00
Update apps
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
ADD_SCENE(evil_portal, start, Start)
|
||||
ADD_SCENE(evil_portal, console_output, ConsoleOutput)
|
||||
ADD_SCENE(evil_portal, rename, Rename)
|
||||
ADD_SCENE(evil_portal, select_html, SelectHtml)
|
||||
|
||||
@@ -22,8 +22,6 @@ void evil_portal_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, void
|
||||
void evil_portal_scene_console_output_on_enter(void* context) {
|
||||
Evil_PortalApp* app = context;
|
||||
|
||||
bool portal_file_set = false;
|
||||
|
||||
TextBox* text_box = app->text_box;
|
||||
text_box_reset(app->text_box);
|
||||
text_box_set_font(text_box, TextBoxFontText);
|
||||
@@ -64,25 +62,24 @@ void evil_portal_scene_console_output_on_enter(void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
if(0 == strncmp(SET_HTML_CMD, app->selected_tx_string, strlen(SET_HTML_CMD))) {
|
||||
portal_file_set = evil_portal_read_index_html(context);
|
||||
if(0 == strncmp("setapname", app->selected_tx_string, strlen("setapname"))) {
|
||||
scene_manager_next_scene(app->scene_manager, Evil_PortalSceneRename);
|
||||
return;
|
||||
}
|
||||
|
||||
if(portal_file_set) {
|
||||
app->command_queue[0] = SET_AP_CMD;
|
||||
app->has_command_queue = true;
|
||||
app->command_index = 0;
|
||||
if(app->show_stopscan_tip) {
|
||||
const char* msg = "Starting portal\nIf no response press\nBACK to return\n";
|
||||
furi_string_cat_str(app->text_box_store, msg);
|
||||
app->text_box_store_strlen += strlen(msg);
|
||||
}
|
||||
} else {
|
||||
if(app->show_stopscan_tip) {
|
||||
const char* msg = "No portal selected\nShowing current logs\nPress "
|
||||
"BACK to return\n";
|
||||
furi_string_cat_str(app->text_box_store, msg);
|
||||
app->text_box_store_strlen += strlen(msg);
|
||||
}
|
||||
if(0 == strncmp("selecthtml", app->selected_tx_string, strlen("selecthtml"))) {
|
||||
scene_manager_next_scene(app->scene_manager, Evil_PortalSceneSelectHtml);
|
||||
return;
|
||||
}
|
||||
|
||||
if(0 == strncmp(SET_HTML_CMD, app->selected_tx_string, strlen(SET_HTML_CMD))) {
|
||||
app->command_queue[0] = SET_AP_CMD;
|
||||
app->has_command_queue = true;
|
||||
app->command_index = 0;
|
||||
if(app->show_stopscan_tip) {
|
||||
const char* msg = "Starting portal\nIf no response press\nBACK to return\n";
|
||||
furi_string_cat_str(app->text_box_store, msg);
|
||||
app->text_box_store_strlen += strlen(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,13 +104,7 @@ void evil_portal_scene_console_output_on_enter(void* context) {
|
||||
|
||||
if(app->is_command && app->selected_tx_string) {
|
||||
if(0 == strncmp(SET_HTML_CMD, app->selected_tx_string, strlen(SET_HTML_CMD))) {
|
||||
if(!portal_file_set) {
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, Evil_PortalSceneConsoleOutput, 0);
|
||||
view_dispatcher_switch_to_view(
|
||||
app->view_dispatcher, Evil_PortalAppViewConsoleOutput);
|
||||
return;
|
||||
}
|
||||
evil_portal_read_index_html(context);
|
||||
|
||||
FuriString* data = furi_string_alloc();
|
||||
furi_string_cat(data, "sethtml=");
|
||||
|
||||
42
applications/external/evil_portal/scenes/evil_portal_scene_rename.c
vendored
Normal file
42
applications/external/evil_portal/scenes/evil_portal_scene_rename.c
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "../evil_portal_app_i.h"
|
||||
#include "../helpers/evil_portal_storage.h"
|
||||
|
||||
void evil_portal_text_input_callback(void* context) {
|
||||
furi_assert(context);
|
||||
Evil_PortalApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, Evil_PortalEventTextInput);
|
||||
}
|
||||
|
||||
void evil_portal_scene_rename_on_enter(void* context) {
|
||||
Evil_PortalApp* app = context;
|
||||
TextInput* text_input = app->text_input;
|
||||
size_t enter_name_length = 25;
|
||||
evil_portal_read_ap_name(app);
|
||||
text_input_set_header_text(text_input, "AP Name/SSID");
|
||||
strncpy(app->text_store[0], (char*)app->ap_name, enter_name_length);
|
||||
text_input_set_result_callback(
|
||||
text_input,
|
||||
evil_portal_text_input_callback,
|
||||
context,
|
||||
app->text_store[0],
|
||||
enter_name_length,
|
||||
false);
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, Evil_PortalAppViewTextInput);
|
||||
}
|
||||
|
||||
bool evil_portal_scene_rename_on_event(void* context, SceneManagerEvent event) {
|
||||
Evil_PortalApp* app = context;
|
||||
SceneManager* scene_manager = app->scene_manager;
|
||||
bool consumed = false;
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
evil_portal_write_ap_name(app);
|
||||
scene_manager_search_and_switch_to_previous_scene(scene_manager, Evil_PortalSceneStart);
|
||||
consumed = true;
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void evil_portal_scene_rename_on_exit(void* context) {
|
||||
Evil_PortalApp* app = context;
|
||||
variable_item_list_reset(app->var_item_list);
|
||||
}
|
||||
54
applications/external/evil_portal/scenes/evil_portal_scene_select_html.c
vendored
Normal file
54
applications/external/evil_portal/scenes/evil_portal_scene_select_html.c
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "../evil_portal_app_i.h"
|
||||
#include "../helpers/evil_portal_storage.h"
|
||||
|
||||
void evil_portal_show_loading_popup(Evil_PortalApp* app, bool show) {
|
||||
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
|
||||
ViewStack* view_stack = app->view_stack;
|
||||
Loading* loading = app->loading;
|
||||
if(show) {
|
||||
// Raise timer priority so that animations can play
|
||||
vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
|
||||
view_stack_add_view(view_stack, loading_get_view(loading));
|
||||
} else {
|
||||
view_stack_remove_view(view_stack, loading_get_view(loading));
|
||||
// Restore default timer priority
|
||||
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
|
||||
}
|
||||
}
|
||||
|
||||
void evil_portal_scene_select_html_on_enter(void* context) {
|
||||
Evil_PortalApp* app = context;
|
||||
DialogsFileBrowserOptions browser_options;
|
||||
evil_portal_create_html_folder_if_not_exists();
|
||||
|
||||
dialog_file_browser_set_basic_options(&browser_options, HTML_EXTENSION, &I_evil_portal_10px);
|
||||
browser_options.base_path = HTML_FOLDER;
|
||||
|
||||
FuriString* path;
|
||||
path = furi_string_alloc();
|
||||
|
||||
furi_string_set(path, HTML_FOLDER);
|
||||
|
||||
bool success = dialog_file_browser_show(app->dialogs, app->file_path, path, &browser_options);
|
||||
furi_string_free(path);
|
||||
|
||||
if(success) {
|
||||
//Replace HTML File
|
||||
evil_portal_show_loading_popup(app, true);
|
||||
evil_portal_replace_index_html(app->file_path);
|
||||
evil_portal_show_loading_popup(app, false);
|
||||
}
|
||||
|
||||
scene_manager_search_and_switch_to_previous_scene(app->scene_manager, Evil_PortalSceneStart);
|
||||
}
|
||||
|
||||
bool evil_portal_scene_select_html_on_event(void* context, SceneManagerEvent event) {
|
||||
UNUSED(context);
|
||||
UNUSED(event);
|
||||
bool consumed = true;
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void evil_portal_scene_select_html_on_exit(void* context) {
|
||||
UNUSED(context);
|
||||
}
|
||||
@@ -33,6 +33,12 @@ const Evil_PortalItem items[NUM_MENU_ITEMS] = {
|
||||
// console
|
||||
{"Save logs", {""}, 1, {"savelogs"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP},
|
||||
|
||||
// set AP name
|
||||
{"Set AP name", {""}, 1, {"setapname"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP},
|
||||
|
||||
// select HTML Portal File
|
||||
{"Select HTML", {""}, 1, {"selecthtml"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP},
|
||||
|
||||
// help
|
||||
{"Help", {""}, 1, {"help"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user