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.js 1.4KB

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