nfc_scene_not_implemented.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "nfc_scene_not_implemented.h"
  2. #include "../nfc_i.h"
  3. #include <furi.h>
  4. #include <gui/modules/dialog_ex.h>
  5. #include <gui/view_dispatcher.h>
  6. void nfc_scene_not_implemented_dialog_callback(DialogExResult result, void* context) {
  7. Nfc* nfc = (Nfc*)context;
  8. view_dispatcher_send_custom_event(nfc->nfc_common.view_dispatcher, result);
  9. }
  10. const void nfc_scene_not_implemented_on_enter(void* context) {
  11. Nfc* nfc = (Nfc*)context;
  12. // TODO Set data from worker
  13. DialogEx* dialog_ex = nfc->dialog_ex;
  14. dialog_ex_set_left_button_text(dialog_ex, "Back");
  15. dialog_ex_set_header(dialog_ex, "Not implemented", 60, 24, AlignCenter, AlignCenter);
  16. dialog_ex_set_context(dialog_ex, nfc);
  17. dialog_ex_set_result_callback(dialog_ex, nfc_scene_not_implemented_dialog_callback);
  18. view_dispatcher_switch_to_view(nfc->nfc_common.view_dispatcher, NfcViewDialogEx);
  19. }
  20. const bool nfc_scene_not_implemented_on_event(void* context, uint32_t event) {
  21. Nfc* nfc = (Nfc*)context;
  22. if(event == DialogExResultLeft) {
  23. view_dispatcher_send_navigation_event(
  24. nfc->nfc_common.view_dispatcher, ViewNavigatorEventBack);
  25. return true;
  26. }
  27. return false;
  28. }
  29. const void nfc_scene_not_implemented_on_exit(void* context) {
  30. Nfc* nfc = (Nfc*)context;
  31. DialogEx* dialog_ex = nfc->dialog_ex;
  32. dialog_ex_set_header(dialog_ex, NULL, 0, 0, AlignCenter, AlignCenter);
  33. dialog_ex_set_text(dialog_ex, NULL, 0, 0, AlignCenter, AlignTop);
  34. dialog_ex_set_left_button_text(dialog_ex, NULL);
  35. dialog_ex_set_result_callback(dialog_ex, NULL);
  36. dialog_ex_set_context(dialog_ex, NULL);
  37. }
  38. AppScene* nfc_scene_not_implemented_alloc() {
  39. AppScene* scene = furi_alloc(sizeof(AppScene));
  40. scene->id = NfcSceneReadCardSuccess;
  41. scene->on_enter = nfc_scene_not_implemented_on_enter;
  42. scene->on_event = nfc_scene_not_implemented_on_event;
  43. scene->on_exit = nfc_scene_not_implemented_on_exit;
  44. return scene;
  45. }
  46. void nfc_scene_not_implemented_free(AppScene* scene) {
  47. free(scene);
  48. }