picopass_scene_acknowledgements.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "../picopass_i.h"
  2. #include <dolphin/dolphin.h>
  3. #include "../acknowledgements.h"
  4. void picopass_scene_acknowledgements_widget_callback(
  5. GuiButtonType result,
  6. InputType type,
  7. void* context) {
  8. Picopass* picopass = context;
  9. if(type == InputTypeShort) {
  10. view_dispatcher_send_custom_event(picopass->view_dispatcher, result);
  11. }
  12. }
  13. void picopass_scene_acknowledgements_on_enter(void* context) {
  14. Picopass* picopass = context;
  15. furi_string_reset(picopass->text_box_store);
  16. FuriString* str = picopass->text_box_store;
  17. furi_string_cat_printf(str, "%s\n", acknowledgements_text);
  18. text_box_set_font(picopass->text_box, TextBoxFontText);
  19. text_box_set_text(picopass->text_box, furi_string_get_cstr(picopass->text_box_store));
  20. view_dispatcher_switch_to_view(picopass->view_dispatcher, PicopassViewTextBox);
  21. }
  22. bool picopass_scene_acknowledgements_on_event(void* context, SceneManagerEvent event) {
  23. Picopass* picopass = context;
  24. bool consumed = false;
  25. if(event.type == SceneManagerEventTypeCustom) {
  26. if(event.event == GuiButtonTypeLeft) {
  27. consumed = scene_manager_previous_scene(picopass->scene_manager);
  28. }
  29. } else if(event.type == SceneManagerEventTypeBack) {
  30. consumed = scene_manager_previous_scene(picopass->scene_manager);
  31. }
  32. return consumed;
  33. }
  34. void picopass_scene_acknowledgements_on_exit(void* context) {
  35. Picopass* picopass = context;
  36. // Clear views
  37. text_box_reset(picopass->text_box);
  38. }