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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { SET_CONFERENCE_TIMESTAMP, SET_SESSION_ID, SET_WATCH_REACHABLE } from './actionTypes';
  2. /**
  3. * Stores a timestamp when the conference is joined, so that the watch counterpart can start counting from when
  4. * the meeting has really started.
  5. *
  6. * @param {number} conferenceTimestamp - A timestamp retrieved with {@code newDate.getTime()}.
  7. * @returns {{
  8. * type: SET_CONFERENCE_TIMESTAMP,
  9. * conferenceTimestamp: number
  10. * }}
  11. */
  12. export function setConferenceTimestamp(conferenceTimestamp: number) {
  13. return {
  14. type: SET_CONFERENCE_TIMESTAMP,
  15. conferenceTimestamp
  16. };
  17. }
  18. /**
  19. * Updates the session ID which is sent to the Watch app and then used by the app to send commands. Commands from
  20. * the watch are accepted only if the 'sessionID' passed by the Watch matches the one currently stored in Redux. It is
  21. * supposed to prevent from processing outdated commands.
  22. *
  23. * @returns {{
  24. * type: SET_SESSION_ID,
  25. * sessionID: number
  26. * }}
  27. */
  28. export function setSessionId() {
  29. return {
  30. type: SET_SESSION_ID,
  31. sessionID: new Date().getTime()
  32. };
  33. }
  34. /**
  35. * Updates the reachable status of the watch. It's used to get in sync with the watch counterpart when it gets
  36. * reconnected, but also to prevent from sending updates if the app is not installed at all (which would fail with
  37. * an error).
  38. *
  39. * @param {boolean} isReachable - Indicates whether the watch is currently reachable or not.
  40. * @returns {{
  41. * type: SET_WATCH_REACHABLE,
  42. * watchReachable: boolean
  43. * }}
  44. */
  45. export function setWatchReachable(isReachable: boolean) {
  46. return {
  47. type: SET_WATCH_REACHABLE,
  48. watchReachable: isReachable
  49. };
  50. }