您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

actions.js 1.7KB

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