mifare_nested_scene_static_encrypted_nonce.c 2.2 KB

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