seos_scene_zero_keys.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "../seos_i.h"
  2. #include <dolphin/dolphin.h>
  3. #define TAG "SeosSceneZeroKeys"
  4. void seos_scene_zero_keys_popup_callback(void* context) {
  5. Seos* seos = context;
  6. view_dispatcher_send_custom_event(seos->view_dispatcher, SeosCustomEventViewExit);
  7. }
  8. void seos_scene_zero_keys_on_enter(void* context) {
  9. Seos* seos = context;
  10. dolphin_deed(DolphinDeedNfcRead);
  11. // Setup view
  12. Popup* popup = seos->popup;
  13. popup_set_header(popup, "NO KEYS", 64, 16, AlignCenter, AlignTop);
  14. popup_set_text(popup, "Using all zero keys", 64, 36, AlignCenter, AlignTop);
  15. popup_set_timeout(popup, 5 * 1000);
  16. popup_set_context(popup, seos);
  17. popup_set_callback(popup, seos_scene_zero_keys_popup_callback);
  18. popup_enable_timeout(popup);
  19. view_dispatcher_switch_to_view(seos->view_dispatcher, SeosViewPopup);
  20. }
  21. bool seos_scene_zero_keys_on_event(void* context, SceneManagerEvent event) {
  22. Seos* seos = context;
  23. bool consumed = false;
  24. if(event.type == SceneManagerEventTypeCustom) {
  25. if(event.event == SeosCustomEventViewExit) {
  26. scene_manager_next_scene(seos->scene_manager, SeosSceneMainMenu);
  27. consumed = true;
  28. }
  29. }
  30. return consumed;
  31. }
  32. void seos_scene_zero_keys_on_exit(void* context) {
  33. Seos* seos = context;
  34. // Clear view
  35. popup_reset(seos->popup);
  36. }