Skip to content

Commit

Permalink
Move parse from card menu to card read success
Browse files Browse the repository at this point in the history
  • Loading branch information
bettse committed Aug 25, 2024
1 parent 56ac248 commit 018f9f6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
19 changes: 0 additions & 19 deletions scenes/seader_scene_card_menu.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "../seader_i.h"

enum SubmenuIndex {
SubmenuIndexParse,
SubmenuIndexSave,
SubmenuIndexSavePicopass,
SubmenuIndexSaveRFID,
Expand All @@ -18,21 +17,8 @@ void seader_scene_card_menu_submenu_callback(void* context, uint32_t index) {
void seader_scene_card_menu_on_enter(void* context) {
Seader* seader = context;
SeaderCredential* credential = seader->credential;
PluginWiegand* plugin = seader->plugin_wiegand;
Submenu* submenu = seader->submenu;

if(plugin) {
size_t format_count = plugin->count(credential->bit_length, credential->credential);
if(format_count > 0) {
submenu_add_item(
submenu,
"Parse",
SubmenuIndexParse,
seader_scene_card_menu_submenu_callback,
seader);
}
}

submenu_add_item(
submenu, "Save", SubmenuIndexSave, seader_scene_card_menu_submenu_callback, seader);
submenu_add_item(
Expand Down Expand Up @@ -100,11 +86,6 @@ bool seader_scene_card_menu_on_event(void* context, SceneManagerEvent event) {
seader->credential->save_format = SeaderCredentialSaveFormatMFC;
scene_manager_next_scene(seader->scene_manager, SeaderSceneSaveName);
consumed = true;
} else if(event.event == SubmenuIndexParse) {
scene_manager_set_scene_state(
seader->scene_manager, SeaderSceneCardMenu, SubmenuIndexParse);
scene_manager_next_scene(seader->scene_manager, SeaderSceneFormats);
consumed = true;
}
} else if(event.type == SceneManagerEventTypeBack) {
consumed = scene_manager_search_and_switch_to_previous_scene(
Expand Down
16 changes: 16 additions & 0 deletions scenes/seader_scene_read_card_success.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ void seader_scene_read_card_success_widget_callback(
void seader_scene_read_card_success_on_enter(void* context) {
Seader* seader = context;
SeaderCredential* credential = seader->credential;
PluginWiegand* plugin = seader->plugin_wiegand;
Widget* widget = seader->widget;

FuriString* type_str = furi_string_alloc();
Expand Down Expand Up @@ -58,6 +59,18 @@ void seader_scene_read_card_success_on_enter(void* context) {
widget_add_button_element(
widget, GuiButtonTypeRight, "More", seader_scene_read_card_success_widget_callback, seader);

if(plugin) {
size_t format_count = plugin->count(credential->bit_length, credential->credential);
if(format_count > 0) {
widget_add_button_element(
seader->widget,
GuiButtonTypeCenter,
"Parse",
seader_scene_read_card_success_widget_callback,
seader);
}
}

widget_add_string_element(
widget, 64, 5, AlignCenter, AlignCenter, FontPrimary, furi_string_get_cstr(type_str));
widget_add_string_element(
Expand Down Expand Up @@ -100,6 +113,9 @@ bool seader_scene_read_card_success_on_event(void* context, SceneManagerEvent ev
} else if(event.event == GuiButtonTypeRight) {
scene_manager_next_scene(seader->scene_manager, SeaderSceneCardMenu);
consumed = true;
} else if(event.event == GuiButtonTypeCenter) {
scene_manager_next_scene(seader->scene_manager, SeaderSceneFormats);
consumed = true;
}
} else if(event.type == SceneManagerEventTypeBack) {
scene_manager_search_and_switch_to_previous_scene(
Expand Down

0 comments on commit 018f9f6

Please sign in to comment.