weebo_scene_write_card_success.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "../weebo_i.h"
  2. #include <dolphin/dolphin.h>
  3. void weebo_scene_write_card_success_widget_callback(
  4. GuiButtonType result,
  5. InputType type,
  6. void* context) {
  7. furi_assert(context);
  8. Weebo* weebo = context;
  9. if(type == InputTypeShort) {
  10. view_dispatcher_send_custom_event(weebo->view_dispatcher, result);
  11. }
  12. }
  13. void weebo_scene_write_card_success_on_enter(void* context) {
  14. Weebo* weebo = context;
  15. Widget* widget = weebo->widget;
  16. FuriString* str = furi_string_alloc_set("Write Success!");
  17. dolphin_deed(DolphinDeedNfcReadSuccess);
  18. // Send notification
  19. notification_message(weebo->notifications, &sequence_success);
  20. widget_add_string_element(
  21. widget, 64, 5, AlignCenter, AlignCenter, FontSecondary, furi_string_get_cstr(str));
  22. furi_string_free(str);
  23. view_dispatcher_switch_to_view(weebo->view_dispatcher, WeeboViewWidget);
  24. }
  25. bool weebo_scene_write_card_success_on_event(void* context, SceneManagerEvent event) {
  26. Weebo* weebo = context;
  27. bool consumed = false;
  28. // Jump back to main menu
  29. if(event.type == SceneManagerEventTypeBack) {
  30. consumed = scene_manager_search_and_switch_to_previous_scene(
  31. weebo->scene_manager, WeeboSceneMainMenu);
  32. }
  33. return consumed;
  34. }
  35. void weebo_scene_write_card_success_on_exit(void* context) {
  36. Weebo* weebo = context;
  37. // Clear view
  38. widget_reset(weebo->widget);
  39. }