mifare_nested_scene_no_keys.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "../mifare_nested_i.h"
  2. void mifare_nested_scene_no_keys_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_no_keys_on_enter(void* context) {
  12. MifareNested* mifare_nested = context;
  13. Widget* widget = mifare_nested->widget;
  14. notification_message(mifare_nested->notifications, &sequence_success);
  15. widget_add_icon_element(widget, 73, 13, &I_DolphinCry);
  16. widget_add_string_element(widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "No keys found");
  17. widget_add_string_element(
  18. widget, 0, 12, AlignLeft, AlignTop, FontSecondary, "Scan tag and find at");
  19. widget_add_string_element(
  20. widget, 0, 22, AlignLeft, AlignTop, FontSecondary, "least one key to");
  21. widget_add_string_element(
  22. widget, 0, 32, AlignLeft, AlignTop, FontSecondary, "start (save dump");
  23. widget_add_string_element(
  24. widget, 0, 42, AlignLeft, AlignTop, FontSecondary, "after scanning!)");
  25. widget_add_button_element(
  26. widget,
  27. GuiButtonTypeLeft,
  28. "Back",
  29. mifare_nested_scene_no_keys_widget_callback,
  30. mifare_nested);
  31. // Setup and start worker
  32. view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget);
  33. }
  34. bool mifare_nested_scene_no_keys_on_event(void* context, SceneManagerEvent event) {
  35. MifareNested* mifare_nested = context;
  36. bool consumed = false;
  37. if(event.type == SceneManagerEventTypeCustom) {
  38. if(event.event == GuiButtonTypeCenter || event.event == GuiButtonTypeLeft) {
  39. scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0);
  40. consumed = true;
  41. }
  42. } else if(event.type == SceneManagerEventTypeBack) {
  43. scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0);
  44. consumed = true;
  45. }
  46. return consumed;
  47. }
  48. void mifare_nested_scene_no_keys_on_exit(void* context) {
  49. MifareNested* mifare_nested = context;
  50. widget_reset(mifare_nested->widget);
  51. }