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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // @flow
  2. import {
  3. CALENDAR_ACCESS_REQUESTED,
  4. NEW_CALENDAR_ENTRY_LIST,
  5. NEW_KNOWN_DOMAIN,
  6. REFRESH_CALENDAR_ENTRY_LIST
  7. } from './actionTypes';
  8. /**
  9. * Sends an action to signal that a calendar access has been requested. For
  10. * more info see the {@link CALENDAR_ACCESS_REQUESTED}.
  11. *
  12. * @param {string | undefined} status - The result of the last calendar
  13. * access request.
  14. * @returns {{
  15. * type: CALENDAR_ACCESS_REQUESTED
  16. * }}
  17. */
  18. export function updateCalendarAccessStatus(status: ?string) {
  19. return {
  20. status,
  21. type: CALENDAR_ACCESS_REQUESTED
  22. };
  23. }
  24. /**
  25. * Sends an action to add a new known domain if not present yet.
  26. *
  27. * @param {string} domainName - The new domain.
  28. * @returns {{
  29. * type: NEW_KNOWN_DOMAIN,
  30. * domainName: string
  31. * }}
  32. */
  33. export function maybeAddNewKnownDomain(domainName: string) {
  34. return {
  35. type: NEW_KNOWN_DOMAIN,
  36. domainName
  37. };
  38. }
  39. /**
  40. * Sends an action to refresh the entry list (fetches new data).
  41. *
  42. * @param {boolean|undefined} forcePermission - Whether to force to re-ask
  43. * for the permission or not.
  44. * @returns {{
  45. * type: REFRESH_CALENDAR_ENTRY_LIST,
  46. * forcePermission: boolean
  47. * }}
  48. */
  49. export function refreshCalendarEntryList(forcePermission: boolean = false) {
  50. return {
  51. forcePermission,
  52. type: REFRESH_CALENDAR_ENTRY_LIST
  53. };
  54. }
  55. /**
  56. * Sends an action to update the current calendar list in redux.
  57. *
  58. * @param {Array<Object>} events - The new list.
  59. * @returns {{
  60. * type: NEW_CALENDAR_ENTRY_LIST,
  61. * events: Array<Object>
  62. * }}
  63. */
  64. export function updateCalendarEntryList(events: Array<Object>) {
  65. return {
  66. type: NEW_CALENDAR_ENTRY_LIST,
  67. events
  68. };
  69. }