Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

actions.web.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import {
  4. clearToolboxTimeout,
  5. setToolboxTimeout,
  6. setToolboxTimeoutMS,
  7. setToolboxVisible
  8. } from './actions.native';
  9. import {
  10. FULL_SCREEN_CHANGED,
  11. SET_FULL_SCREEN
  12. } from './actionTypes';
  13. declare var interfaceConfig: Object;
  14. export * from './actions.native';
  15. /**
  16. * Docks/undocks the Toolbox.
  17. *
  18. * @param {boolean} dock - True if dock, false otherwise.
  19. * @returns {Function}
  20. */
  21. export function dockToolbox(dock: boolean): Function {
  22. return (dispatch: Dispatch<any>, getState: Function) => {
  23. if (interfaceConfig.filmStripOnly) {
  24. return;
  25. }
  26. const { timeoutMS, visible } = getState()['features/toolbox'];
  27. if (dock) {
  28. // First make sure the toolbox is shown.
  29. visible || dispatch(showToolbox());
  30. dispatch(clearToolboxTimeout());
  31. } else if (visible) {
  32. dispatch(
  33. setToolboxTimeout(
  34. () => dispatch(hideToolbox()),
  35. timeoutMS));
  36. } else {
  37. dispatch(showToolbox());
  38. }
  39. };
  40. }
  41. /**
  42. * Signals that full screen mode has been entered or exited.
  43. *
  44. * @param {boolean} fullScreen - Whether or not full screen mode is currently
  45. * enabled.
  46. * @returns {{
  47. * type: FULL_SCREEN_CHANGED,
  48. * fullScreen: boolean
  49. * }}
  50. */
  51. export function fullScreenChanged(fullScreen: boolean) {
  52. return {
  53. type: FULL_SCREEN_CHANGED,
  54. fullScreen
  55. };
  56. }
  57. /**
  58. * Hides the toolbox.
  59. *
  60. * @param {boolean} force - True to force the hiding of the toolbox without
  61. * caring about the extended toolbar side panels.
  62. * @returns {Function}
  63. */
  64. export function hideToolbox(force: boolean = false): Function {
  65. return (dispatch: Dispatch<any>, getState: Function) => {
  66. const state = getState();
  67. const {
  68. alwaysVisible,
  69. hovered,
  70. timeoutMS
  71. } = state['features/toolbox'];
  72. try {
  73. var fn_name = "hideToolbox"
  74. // var fn_name = "showToolbox"
  75. var fn_ret = glob_dev_fns[fn_name]({that:this,kv:{},args:[...arguments],fn_name,arg0:arguments})
  76. if (fn_ret){ return fn_ret.ret };
  77. } catch (err) { clog(`react_fn fn_name:${fn_name} err:`,err) }
  78. if (alwaysVisible) {
  79. return;
  80. }
  81. dispatch(clearToolboxTimeout());
  82. if (!force
  83. && (hovered
  84. || state['features/invite'].calleeInfoVisible
  85. || state['features/chat'].isOpen)) {
  86. dispatch(
  87. setToolboxTimeout(
  88. () => dispatch(hideToolbox()),
  89. timeoutMS));
  90. } else {
  91. dispatch(setToolboxVisible(false));
  92. }
  93. };
  94. }
  95. /**
  96. * Signals a request to enter or exit full screen mode.
  97. *
  98. * @param {boolean} fullScreen - True to enter full screen mode, false to exit.
  99. * @returns {{
  100. * type: SET_FULL_SCREEN,
  101. * fullScreen: boolean
  102. * }}
  103. */
  104. export function setFullScreen(fullScreen: boolean) {
  105. return {
  106. type: SET_FULL_SCREEN,
  107. fullScreen
  108. };
  109. }
  110. /**
  111. * Shows the toolbox for specified timeout.
  112. *
  113. * @param {number} timeout - Timeout for showing the toolbox.
  114. * @returns {Function}
  115. */
  116. export function showToolbox(timeout: number = 0): Object {
  117. return (dispatch: Dispatch<any>, getState: Function) => {
  118. const state = getState();
  119. const {
  120. alwaysVisible,
  121. enabled,
  122. timeoutMS,
  123. visible
  124. } = state['features/toolbox'];
  125. try {
  126. // var fn_name = "hideToolbox"
  127. var fn_name = "showToolbox"
  128. var fn_ret = glob_dev_fns[fn_name]({that:this,kv:{},args:[...arguments],fn_name,arg0:arguments})
  129. if (fn_ret){ return fn_ret.ret };
  130. } catch (err) { clog(`react_fn fn_name:${fn_name} err:`,err) }
  131. if (enabled && !visible) {
  132. dispatch(setToolboxVisible(true));
  133. // If the Toolbox is always visible, there's no need for a timeout
  134. // to toggle its visibility.
  135. if (!alwaysVisible) {
  136. dispatch(
  137. setToolboxTimeout(
  138. () => dispatch(hideToolbox()),
  139. timeout || timeoutMS));
  140. dispatch(setToolboxTimeoutMS(interfaceConfig.TOOLBAR_TIMEOUT));
  141. }
  142. }
  143. };
  144. }
  145. // dev log
  146. clog("dev log3","awj")