passy_scene_read_success.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "../passy_i.h"
  2. #include <dolphin/dolphin.h>
  3. #define TAG "PassySceneReadCardSuccess"
  4. void passy_scene_read_success_on_enter(void* context) {
  5. Passy* passy = context;
  6. dolphin_deed(DolphinDeedNfcReadSuccess);
  7. notification_message(passy->notifications, &sequence_success);
  8. furi_string_reset(passy->text_box_store);
  9. FuriString* str = passy->text_box_store;
  10. furi_string_cat_printf(str, "%s\n", bit_buffer_get_data(passy->DG1) + 3);
  11. text_box_set_font(passy->text_box, TextBoxFontText);
  12. text_box_set_text(passy->text_box, furi_string_get_cstr(passy->text_box_store));
  13. view_dispatcher_switch_to_view(passy->view_dispatcher, PassyViewTextBox);
  14. }
  15. bool passy_scene_read_success_on_event(void* context, SceneManagerEvent event) {
  16. Passy* passy = context;
  17. bool consumed = false;
  18. if(event.type == SceneManagerEventTypeCustom) {
  19. } else if(event.type == SceneManagerEventTypeBack) {
  20. scene_manager_search_and_switch_to_previous_scene(
  21. passy->scene_manager, PassySceneMainMenu);
  22. consumed = true;
  23. }
  24. return consumed;
  25. }
  26. void passy_scene_read_success_on_exit(void* context) {
  27. Passy* passy = context;
  28. // Clear view
  29. text_box_reset(passy->text_box);
  30. }