|
| 1 | +#include "../mifare_nested_i.h" |
| 2 | + |
| 3 | +void mifare_nested_scene_static_encrypted_nonce_widget_callback( |
| 4 | + GuiButtonType result, |
| 5 | + InputType type, |
| 6 | + void* context) { |
| 7 | + MifareNested* mifare_nested = context; |
| 8 | + if(type == InputTypeShort) { |
| 9 | + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); |
| 10 | + } |
| 11 | +} |
| 12 | + |
| 13 | +void mifare_nested_scene_static_encrypted_nonce_on_enter(void* context) { |
| 14 | + MifareNested* mifare_nested = context; |
| 15 | + Widget* widget = mifare_nested->widget; |
| 16 | + |
| 17 | + notification_message(mifare_nested->notifications, &sequence_error); |
| 18 | + |
| 19 | + widget_add_icon_element(widget, 73, 12, &I_DolphinCry); |
| 20 | + widget_add_string_element( |
| 21 | + widget, 1, 9, AlignLeft, AlignTop, FontPrimary, "Static encrypted nonce"); |
| 22 | + widget_add_string_element( |
| 23 | + widget, 1, 19, AlignLeft, AlignTop, FontSecondary, "This tag can't be"); |
| 24 | + widget_add_string_element( |
| 25 | + widget, 1, 29, AlignLeft, AlignTop, FontSecondary, "used with Nested"); |
| 26 | + widget_add_string_element(widget, 1, 39, AlignLeft, AlignTop, FontSecondary, "attack."); |
| 27 | + |
| 28 | + widget_add_button_element( |
| 29 | + widget, |
| 30 | + GuiButtonTypeLeft, |
| 31 | + "Back", |
| 32 | + mifare_nested_scene_static_encrypted_nonce_widget_callback, |
| 33 | + mifare_nested); |
| 34 | + |
| 35 | + // Setup and start worker |
| 36 | + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget); |
| 37 | +} |
| 38 | + |
| 39 | +bool mifare_nested_scene_static_encrypted_nonce_on_event(void* context, SceneManagerEvent event) { |
| 40 | + MifareNested* mifare_nested = context; |
| 41 | + bool consumed = false; |
| 42 | + |
| 43 | + if(event.type == SceneManagerEventTypeCustom) { |
| 44 | + if(event.event == GuiButtonTypeCenter || event.event == GuiButtonTypeLeft) { |
| 45 | + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); |
| 46 | + consumed = true; |
| 47 | + } |
| 48 | + } else if(event.type == SceneManagerEventTypeBack) { |
| 49 | + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); |
| 50 | + consumed = true; |
| 51 | + } |
| 52 | + |
| 53 | + return consumed; |
| 54 | +} |
| 55 | + |
| 56 | +void mifare_nested_scene_static_encrypted_nonce_on_exit(void* context) { |
| 57 | + MifareNested* mifare_nested = context; |
| 58 | + |
| 59 | + widget_reset(mifare_nested->widget); |
| 60 | +} |
0 commit comments