mifare_nested_scene_need_collection.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "../mifare_nested_i.h"
  2. void mifare_nested_scene_need_collection_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_need_collection_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, 13, &I_DolphinCry);
  16. widget_add_string_element(
  17. widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "Missing collected nonces");
  18. widget_add_string_element(
  19. widget, 0, 12, AlignLeft, AlignTop, FontSecondary, "Run \"Nested attack\"");
  20. widget_add_button_element(
  21. widget,
  22. GuiButtonTypeLeft,
  23. "Back",
  24. mifare_nested_scene_need_collection_widget_callback,
  25. mifare_nested);
  26. // Setup and start worker
  27. view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget);
  28. }
  29. bool mifare_nested_scene_need_collection_on_event(void* context, SceneManagerEvent event) {
  30. MifareNested* mifare_nested = context;
  31. bool consumed = false;
  32. if(event.type == SceneManagerEventTypeCustom) {
  33. if(event.event == GuiButtonTypeCenter || event.event == GuiButtonTypeLeft) {
  34. scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0);
  35. consumed = true;
  36. }
  37. } else if(event.type == SceneManagerEventTypeBack) {
  38. scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0);
  39. consumed = true;
  40. }
  41. return consumed;
  42. }
  43. void mifare_nested_scene_need_collection_on_exit(void* context) {
  44. MifareNested* mifare_nested = context;
  45. widget_reset(mifare_nested->widget);
  46. }