infrared_scene_edit_delete_done.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include "../infrared_i.h"
  2. void infrared_scene_edit_delete_done_on_enter(void* context) {
  3. Infrared* infrared = context;
  4. Popup* popup = infrared->popup;
  5. popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62);
  6. popup_set_header(popup, "Deleted", 83, 19, AlignLeft, AlignBottom);
  7. popup_set_callback(popup, infrared_popup_closed_callback);
  8. popup_set_context(popup, context);
  9. popup_set_timeout(popup, 1500);
  10. popup_enable_timeout(popup);
  11. view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup);
  12. }
  13. bool infrared_scene_edit_delete_done_on_event(void* context, SceneManagerEvent event) {
  14. Infrared* infrared = context;
  15. SceneManager* scene_manager = infrared->scene_manager;
  16. bool consumed = false;
  17. if(event.type == SceneManagerEventTypeCustom) {
  18. if(event.event == InfraredCustomEventTypePopupClosed) {
  19. const InfraredEditTarget edit_target = infrared->app_state.edit_target;
  20. if(edit_target == InfraredEditTargetButton) {
  21. scene_manager_search_and_switch_to_previous_scene(
  22. scene_manager, InfraredSceneRemote);
  23. } else if(edit_target == InfraredEditTargetRemote) {
  24. const uint32_t possible_scenes[] = {InfraredSceneStart, InfraredSceneRemoteList};
  25. if(!scene_manager_search_and_switch_to_previous_scene_one_of(
  26. scene_manager, possible_scenes, COUNT_OF(possible_scenes))) {
  27. view_dispatcher_stop(infrared->view_dispatcher);
  28. }
  29. } else {
  30. furi_assert(0);
  31. }
  32. consumed = true;
  33. }
  34. }
  35. return consumed;
  36. }
  37. void infrared_scene_edit_delete_done_on_exit(void* context) {
  38. Infrared* infrared = context;
  39. UNUSED(infrared);
  40. }