t5577_multiwriter_scene_write_success.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "../t5577_multiwriter_i.h"
  2. void t5577_multiwriter_scene_write_success_on_enter(void* context) {
  3. LfRfid* app = context;
  4. Popup* popup = app->popup;
  5. popup_set_header(popup, "Successfully\nwritten!", 94, 3, AlignCenter, AlignTop);
  6. popup_set_icon(popup, 0, 6, &I_DolphinSuccess_91x55);
  7. popup_set_context(popup, app);
  8. popup_set_callback(popup, t5577_multiwriter_popup_timeout_callback);
  9. popup_set_timeout(popup, 1500);
  10. popup_enable_timeout(popup);
  11. view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
  12. notification_message_block(app->notifications, &sequence_set_green_255);
  13. }
  14. bool t5577_multiwriter_scene_write_success_on_event(void* context, SceneManagerEvent event) {
  15. LfRfid* app = context;
  16. bool consumed = false;
  17. const uint32_t prev_scenes[] = {LfRfidSceneStart};
  18. if((event.type == SceneManagerEventTypeBack) ||
  19. ((event.type == SceneManagerEventTypeCustom) && (event.event == LfRfidEventPopupClosed))) {
  20. scene_manager_search_and_switch_to_previous_scene_one_of(
  21. app->scene_manager, prev_scenes, COUNT_OF(prev_scenes));
  22. consumed = true;
  23. }
  24. return consumed;
  25. }
  26. void t5577_multiwriter_scene_write_success_on_exit(void* context) {
  27. LfRfid* app = context;
  28. notification_message_block(app->notifications, &sequence_reset_green);
  29. popup_reset(app->popup);
  30. }