Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

functions.web.js 2.7KB

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