nfc_maker_scene_https.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #include "../nfc_maker.h"
  2. enum TextInputResult {
  3. TextInputResultOk,
  4. };
  5. static void nfc_maker_scene_https_text_input_callback(void* context) {
  6. NfcMaker* app = context;
  7. view_dispatcher_send_custom_event(app->view_dispatcher, TextInputResultOk);
  8. }
  9. void nfc_maker_scene_https_on_enter(void* context) {
  10. NfcMaker* app = context;
  11. TextInput* text_input = app->text_input;
  12. text_input_set_header_text(text_input, "Enter Https Link:");
  13. strlcpy(
  14. app->big_buf,
  15. #ifdef FW_ORIGIN_Momentum
  16. "momentum-fw.dev",
  17. #else
  18. "flipperzero.one",
  19. #endif
  20. sizeof(app->big_buf));
  21. text_input_set_result_callback(
  22. text_input,
  23. nfc_maker_scene_https_text_input_callback,
  24. app,
  25. app->big_buf,
  26. sizeof(app->big_buf),
  27. true);
  28. text_input_show_illegal_symbols(text_input, true);
  29. view_dispatcher_switch_to_view(app->view_dispatcher, NfcMakerViewTextInput);
  30. }
  31. bool nfc_maker_scene_https_on_event(void* context, SceneManagerEvent event) {
  32. NfcMaker* app = context;
  33. bool consumed = false;
  34. if(event.type == SceneManagerEventTypeCustom) {
  35. consumed = true;
  36. switch(event.event) {
  37. case TextInputResultOk:
  38. scene_manager_next_scene(app->scene_manager, NfcMakerSceneSaveGenerate);
  39. break;
  40. default:
  41. break;
  42. }
  43. }
  44. return consumed;
  45. }
  46. void nfc_maker_scene_https_on_exit(void* context) {
  47. NfcMaker* app = context;
  48. text_input_reset(app->text_input);
  49. }