mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 02:18:35 -07:00
Update system apps
This commit is contained in:
@@ -6,4 +6,7 @@ ADD_SCENE(subrem, edit_submenu, EditSubMenu)
|
||||
ADD_SCENE(subrem, edit_label, EditLabel)
|
||||
ADD_SCENE(subrem, open_sub_file, OpenSubFile)
|
||||
ADD_SCENE(subrem, edit_preview, EditPreview)
|
||||
ADD_SCENE(subrem, enter_new_name, EnterNewName)
|
||||
ADD_SCENE(subrem, enter_new_name, EnterNewName)
|
||||
#ifdef FW_ORIGIN_Official
|
||||
ADD_SCENE(subrem, fw_warning, FwWarning)
|
||||
#endif
|
||||
@@ -29,7 +29,7 @@ void subrem_scene_edit_label_widget_callback(GuiButtonType result, InputType typ
|
||||
void subrem_scene_edit_label_on_enter(void* context) {
|
||||
SubGhzRemoteApp* app = context;
|
||||
|
||||
SubRemSubFilePreset* sub_preset = app->map_preset->subs_preset[app->chusen_sub];
|
||||
SubRemSubFilePreset* sub_preset = app->map_preset->subs_preset[app->chosen_sub];
|
||||
|
||||
FuriString* temp_str = furi_string_alloc();
|
||||
|
||||
@@ -53,9 +53,9 @@ void subrem_scene_edit_label_on_enter(void* context) {
|
||||
app->file_name_tmp,
|
||||
25,
|
||||
false);
|
||||
|
||||
#ifndef FW_ORIGIN_Official
|
||||
text_input_set_minimum_length(app->text_input, 0);
|
||||
|
||||
#endif
|
||||
widget_add_string_element(
|
||||
app->widget, 63, 12, AlignCenter, AlignCenter, FontPrimary, "Empty Label Name");
|
||||
widget_add_string_element(
|
||||
@@ -76,7 +76,7 @@ void subrem_scene_edit_label_on_enter(void* context) {
|
||||
bool subrem_scene_edit_label_on_event(void* context, SceneManagerEvent event) {
|
||||
SubGhzRemoteApp* app = context;
|
||||
|
||||
FuriString* label = app->map_preset->subs_preset[app->chusen_sub]->label;
|
||||
FuriString* label = app->map_preset->subs_preset[app->chosen_sub]->label;
|
||||
|
||||
if(event.type == SceneManagerEventTypeBack) {
|
||||
if(scene_manager_get_scene_state(app->scene_manager, SubRemSceneEditLabel) ==
|
||||
|
||||
@@ -101,7 +101,7 @@ bool subrem_scene_edit_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
return true;
|
||||
} else if(event.event == SubRemCustomEventViewEditMenuEdit) {
|
||||
app->chusen_sub = subrem_view_edit_menu_get_index(app->subrem_edit_menu);
|
||||
app->chosen_sub = subrem_view_edit_menu_get_index(app->subrem_edit_menu);
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, SubRemSceneEditSubMenu, EditSubmenuIndexEditLabel);
|
||||
scene_manager_next_scene(app->scene_manager, SubRemSceneEditSubMenu);
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
#include "../subghz_remote_app_i.h"
|
||||
#include "../helpers/subrem_custom_event.h"
|
||||
#ifdef FW_ORIGIN_Official
|
||||
typedef enum {
|
||||
SceneFwWarningStateAttention,
|
||||
SceneFwWarningStateAccept,
|
||||
} SceneFwWarningState;
|
||||
|
||||
static void subrem_scene_fw_warning_widget_render(SubGhzRemoteApp* app, SceneFwWarningState state);
|
||||
|
||||
static void
|
||||
subrem_scene_fw_warning_widget_callback(GuiButtonType result, InputType type, void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzRemoteApp* app = context;
|
||||
|
||||
if(type == InputTypeShort) {
|
||||
SubRemCustomEvent event = SubRemCustomEventSceneFwWarningExit;
|
||||
|
||||
switch(scene_manager_get_scene_state(app->scene_manager, SubRemSceneFwWarning)) {
|
||||
case SceneFwWarningStateAttention:
|
||||
if(result == GuiButtonTypeRight) {
|
||||
event = SubRemCustomEventSceneFwWarningNext;
|
||||
}
|
||||
break;
|
||||
|
||||
case SceneFwWarningStateAccept:
|
||||
if(result == GuiButtonTypeRight) {
|
||||
event = SubRemCustomEventSceneFwWarningContinue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, event);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
subrem_scene_fw_warning_widget_render(SubGhzRemoteApp* app, SceneFwWarningState state) {
|
||||
furi_assert(app);
|
||||
Widget* widget = app->widget;
|
||||
|
||||
widget_reset(widget);
|
||||
|
||||
switch(state) {
|
||||
case SceneFwWarningStateAttention:
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeLeft, "Exit", subrem_scene_fw_warning_widget_callback, app);
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeRight, "Continue", subrem_scene_fw_warning_widget_callback, app);
|
||||
widget_add_string_element(
|
||||
widget, 64, 12, AlignCenter, AlignBottom, FontPrimary, "Not official FW");
|
||||
widget_add_string_multiline_element(
|
||||
widget,
|
||||
64,
|
||||
32,
|
||||
AlignCenter,
|
||||
AlignCenter,
|
||||
FontSecondary,
|
||||
"You are using custom firmware\nPlease download a compatible\nversion of the application");
|
||||
break;
|
||||
|
||||
case SceneFwWarningStateAccept:
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeLeft, "Exit", subrem_scene_fw_warning_widget_callback, app);
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeRight, "Accept", subrem_scene_fw_warning_widget_callback, app);
|
||||
widget_add_string_element(
|
||||
widget, 64, 12, AlignCenter, AlignBottom, FontPrimary, "Not official FW");
|
||||
widget_add_string_multiline_element(
|
||||
widget,
|
||||
64,
|
||||
32,
|
||||
AlignCenter,
|
||||
AlignCenter,
|
||||
FontSecondary,
|
||||
"Yes, I understand that\nthe application can\nbreak my subghz key file");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void subrem_scene_fw_warning_on_enter(void* context) {
|
||||
furi_assert(context);
|
||||
|
||||
SubGhzRemoteApp* app = context;
|
||||
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, SubRemSceneFwWarning, SceneFwWarningStateAttention);
|
||||
|
||||
subrem_scene_fw_warning_widget_render(app, SceneFwWarningStateAttention);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDWidget);
|
||||
}
|
||||
|
||||
bool subrem_scene_fw_warning_on_event(void* context, SceneManagerEvent event) {
|
||||
furi_assert(context);
|
||||
|
||||
SubGhzRemoteApp* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeBack) {
|
||||
consumed = true;
|
||||
} else if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubRemCustomEventSceneFwWarningExit) {
|
||||
scene_manager_stop(app->scene_manager);
|
||||
view_dispatcher_stop(app->view_dispatcher);
|
||||
consumed = true;
|
||||
} else if(event.event == SubRemCustomEventSceneFwWarningNext) {
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, SubRemSceneFwWarning, SceneFwWarningStateAccept);
|
||||
subrem_scene_fw_warning_widget_render(app, SceneFwWarningStateAccept);
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDWidget);
|
||||
consumed = true;
|
||||
} else if(event.event == SubRemCustomEventSceneFwWarningContinue) {
|
||||
scene_manager_previous_scene(app->scene_manager);
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void subrem_scene_fw_warning_on_exit(void* context) {
|
||||
furi_assert(context);
|
||||
|
||||
SubGhzRemoteApp* app = context;
|
||||
widget_reset(app->widget);
|
||||
}
|
||||
#endif
|
||||
@@ -9,7 +9,7 @@ void subrem_scene_open_sub_file_error_popup_callback(void* context) {
|
||||
SubRemLoadSubState subrem_scene_open_sub_file_dialog(SubGhzRemoteApp* app) {
|
||||
furi_assert(app);
|
||||
|
||||
SubRemSubFilePreset* sub = app->map_preset->subs_preset[app->chusen_sub];
|
||||
SubRemSubFilePreset* sub = app->map_preset->subs_preset[app->chosen_sub];
|
||||
|
||||
FuriString* temp_file_path = furi_string_alloc();
|
||||
|
||||
@@ -48,8 +48,8 @@ SubRemLoadSubState subrem_scene_open_sub_file_dialog(SubGhzRemoteApp* app) {
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
if(ret == SubRemLoadSubStateOK) {
|
||||
subrem_sub_file_preset_free(app->map_preset->subs_preset[app->chusen_sub]);
|
||||
app->map_preset->subs_preset[app->chusen_sub] = sub_candidate;
|
||||
subrem_sub_file_preset_free(app->map_preset->subs_preset[app->chosen_sub]);
|
||||
app->map_preset->subs_preset[app->chosen_sub] = sub_candidate;
|
||||
app->map_not_saved = true;
|
||||
} else {
|
||||
subrem_sub_file_preset_free(sub_candidate);
|
||||
|
||||
@@ -66,19 +66,19 @@ bool subrem_scene_remote_on_event(void* context, SceneManagerEvent event) {
|
||||
// Start sending sub
|
||||
subrem_tx_stop_sub(app, true);
|
||||
|
||||
uint8_t chusen_sub = subrem_scene_remote_event_to_index(event.event);
|
||||
app->chusen_sub = chusen_sub;
|
||||
uint8_t chosen_sub = subrem_scene_remote_event_to_index(event.event);
|
||||
app->chosen_sub = chosen_sub;
|
||||
|
||||
subrem_view_remote_set_state(
|
||||
app->subrem_remote_view, SubRemViewRemoteStateLoading, chusen_sub);
|
||||
app->subrem_remote_view, SubRemViewRemoteStateLoading, chosen_sub);
|
||||
|
||||
if(subrem_tx_start_sub(app, app->map_preset->subs_preset[chusen_sub])) {
|
||||
if(app->map_preset->subs_preset[chusen_sub]->type == SubGhzProtocolTypeRAW) {
|
||||
if(subrem_tx_start_sub(app, app->map_preset->subs_preset[chosen_sub])) {
|
||||
if(app->map_preset->subs_preset[chosen_sub]->type == SubGhzProtocolTypeRAW) {
|
||||
subghz_txrx_set_raw_file_encoder_worker_callback_end(
|
||||
app->txrx, subrem_scene_remote_raw_callback_end_tx, app);
|
||||
}
|
||||
subrem_view_remote_set_state(
|
||||
app->subrem_remote_view, SubRemViewRemoteStateSending, chusen_sub);
|
||||
app->subrem_remote_view, SubRemViewRemoteStateSending, chosen_sub);
|
||||
notification_message(app->notifications, &sequence_blink_start_magenta);
|
||||
} else {
|
||||
subrem_view_remote_set_state(
|
||||
|
||||
Reference in New Issue
Block a user