選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

functions.web.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // @flow
  2. import { hasAvailableDevices } from '../base/devices';
  3. declare var interfaceConfig: Object;
  4. /**
  5. * Helper for getting the height of the toolbox.
  6. *
  7. * @returns {number} The height of the toolbox.
  8. */
  9. export function getToolboxHeight() {
  10. const toolbox = document.getElementById('new-toolbox');
  11. return (toolbox && toolbox.clientHeight) || 0;
  12. }
  13. /**
  14. * Indicates if a toolbar button is enabled.
  15. *
  16. * @param {string} name - The name of the setting section as defined in
  17. * interface_config.js.
  18. * @returns {boolean} - True to indicate that the given toolbar button
  19. * is enabled, false - otherwise.
  20. */
  21. export function isButtonEnabled(name: string) {
  22. return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1;
  23. }
  24. /**
  25. * Indicates if the toolbox is visible or not.
  26. *
  27. * @param {string} state - The state from the Redux store.
  28. * @returns {boolean} - True to indicate that the toolbox is visible, false -
  29. * otherwise.
  30. */
  31. export function isToolboxVisible(state: Object) {
  32. const { iAmSipGateway } = state['features/base/config'];
  33. const {
  34. alwaysVisible,
  35. timeoutID,
  36. visible
  37. } = state['features/toolbox'];
  38. const { audioSettingsVisible, videoSettingsVisible } = state['features/settings'];
  39. return Boolean(!iAmSipGateway && (timeoutID || visible || alwaysVisible
  40. || audioSettingsVisible || videoSettingsVisible));
  41. }
  42. /**
  43. * Indicates if the audio settings button is disabled or not.
  44. *
  45. * @param {string} state - The state from the Redux store.
  46. * @returns {boolean}
  47. */
  48. export function isAudioSettingsButtonDisabled(state: Object) {
  49. return (!hasAvailableDevices(state, 'audioInput')
  50. && !hasAvailableDevices(state, 'audioOutput'))
  51. || state['features/base/config'].startSilent;
  52. }
  53. /**
  54. * Indicates if the video settings button is disabled or not.
  55. *
  56. * @param {string} state - The state from the Redux store.
  57. * @returns {boolean}
  58. */
  59. export function isVideoSettingsButtonDisabled(state: Object) {
  60. return !hasAvailableDevices(state, 'videoInput');
  61. }