You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.native.ts 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // @ts-expect-error
  2. import { generateRoomWithoutSeparator } from '@jitsi/js-utils/random';
  3. import { getDefaultURL } from '../app/functions';
  4. import { IStore } from '../app/types';
  5. import { openDialog } from '../base/dialog/actions';
  6. import { refreshCalendar } from './actions';
  7. import {
  8. UpdateCalendarEventDialog
  9. // @ts-ignore
  10. } from './components';
  11. import { addLinkToCalendarEntry } from './functions.native';
  12. export * from './actions.any';
  13. /**
  14. * Asks confirmation from the user to add a Jitsi link to the calendar event.
  15. *
  16. * @param {string} eventId - The event id.
  17. * @returns {{
  18. * type: OPEN_DIALOG,
  19. * component: React.Component,
  20. * componentProps: (Object | undefined)
  21. * }}
  22. */
  23. export function openUpdateCalendarEventDialog(eventId: string) {
  24. return openDialog(UpdateCalendarEventDialog, { eventId });
  25. }
  26. /**
  27. * Updates calendar event by generating new invite URL and editing the event
  28. * adding some descriptive text and location.
  29. *
  30. * @param {string} eventId - The event id.
  31. * @returns {Function}
  32. */
  33. export function updateCalendarEvent(eventId: string) {
  34. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  35. const defaultUrl = getDefaultURL(getState);
  36. const roomName = generateRoomWithoutSeparator();
  37. addLinkToCalendarEntry(getState(), eventId, `${defaultUrl}/${roomName}`)
  38. // @ts-ignore
  39. .finally(() => {
  40. dispatch(refreshCalendar(false, false));
  41. });
  42. };
  43. }