nfc_scene_mf_ultralight_unlock_warn.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "../nfc_i.h"
  2. void nfc_scene_mf_ultralight_unlock_warn_dialog_callback(DialogExResult result, void* context) {
  3. Nfc* nfc = context;
  4. view_dispatcher_send_custom_event(nfc->view_dispatcher, result);
  5. }
  6. void nfc_scene_mf_ultralight_unlock_warn_on_enter(void* context) {
  7. Nfc* nfc = context;
  8. DialogEx* dialog_ex = nfc->dialog_ex;
  9. dialog_ex_set_context(dialog_ex, nfc);
  10. dialog_ex_set_result_callback(dialog_ex, nfc_scene_mf_ultralight_unlock_warn_dialog_callback);
  11. dialog_ex_set_header(dialog_ex, "Risky function!", 64, 4, AlignCenter, AlignTop);
  12. dialog_ex_set_text(
  13. dialog_ex, "Wrong password\ncan block your\ncard.", 4, 18, AlignLeft, AlignTop);
  14. dialog_ex_set_icon(dialog_ex, 73, 20, &I_DolphinCommon_56x48);
  15. dialog_ex_set_center_button_text(dialog_ex, "OK");
  16. view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewDialogEx);
  17. }
  18. bool nfc_scene_mf_ultralight_unlock_warn_on_event(void* context, SceneManagerEvent event) {
  19. Nfc* nfc = context;
  20. bool consumed = false;
  21. if(event.type == SceneManagerEventTypeCustom) {
  22. if(event.event == DialogExResultCenter) {
  23. scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightReadAuth);
  24. consumed = true;
  25. }
  26. }
  27. return consumed;
  28. }
  29. void nfc_scene_mf_ultralight_unlock_warn_on_exit(void* context) {
  30. Nfc* nfc = context;
  31. dialog_ex_reset(nfc->dialog_ex);
  32. submenu_reset(nfc->submenu);
  33. }