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

functions.web.ts 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import { IReduxState } from '../../app/types';
  2. import { IConfig, IDeeplinkingConfig, IDeeplinkingMobileConfig, IDeeplinkingPlatformConfig } from './configType';
  3. import { TOOLBAR_BUTTONS } from './constants';
  4. export * from './functions.any';
  5. /**
  6. * Removes all analytics related options from the given configuration, in case of a libre build.
  7. *
  8. * @param {*} _config - The configuration which needs to be cleaned up.
  9. * @returns {void}
  10. */
  11. export function _cleanupConfig(_config: IConfig) {
  12. return;
  13. }
  14. /**
  15. * Returns the replaceParticipant config.
  16. *
  17. * @param {Object} state - The state of the app.
  18. * @returns {boolean}
  19. */
  20. export function getReplaceParticipant(state: IReduxState): string | undefined {
  21. return state['features/base/config'].replaceParticipant;
  22. }
  23. /**
  24. * Returns the list of enabled toolbar buttons.
  25. *
  26. * @param {Object} state - The redux state.
  27. * @returns {Array<string>} - The list of enabled toolbar buttons.
  28. */
  29. export function getToolbarButtons(state: IReduxState): Array<string> {
  30. const { toolbarButtons } = state['features/base/config'];
  31. return Array.isArray(toolbarButtons) ? toolbarButtons : TOOLBAR_BUTTONS;
  32. }
  33. /**
  34. * Checks if the specified button is enabled.
  35. *
  36. * @param {string} buttonName - The name of the button.
  37. * {@link interfaceConfig}.
  38. * @param {Object|Array<string>} state - The redux state or the array with the enabled buttons.
  39. * @returns {boolean} - True if the button is enabled and false otherwise.
  40. */
  41. export function isToolbarButtonEnabled(buttonName: string, state: IReduxState | Array<string>) {
  42. const buttons = Array.isArray(state) ? state : getToolbarButtons(state);
  43. return buttons.includes(buttonName);
  44. }
  45. /**
  46. * Returns whether audio level measurement is enabled or not.
  47. *
  48. * @param {Object} state - The state of the app.
  49. * @returns {boolean}
  50. */
  51. export function areAudioLevelsEnabled(state: IReduxState): boolean {
  52. // Default to false for React Native as audio levels are of no interest to the mobile app.
  53. return navigator.product !== 'ReactNative' && !state['features/base/config'].disableAudioLevels;
  54. }
  55. /**
  56. * Sets the defaults for deeplinking.
  57. *
  58. * @param {IDeeplinkingConfig} deeplinking - The deeplinking config.
  59. * @returns {void}
  60. */
  61. export function _setDeeplinkingDefaults(deeplinking: IDeeplinkingConfig) {
  62. const {
  63. desktop = {} as IDeeplinkingPlatformConfig,
  64. android = {} as IDeeplinkingMobileConfig,
  65. ios = {} as IDeeplinkingMobileConfig
  66. } = deeplinking;
  67. desktop.appName = desktop.appName || 'Jitsi Meet';
  68. ios.appName = ios.appName || 'Jitsi Meet';
  69. ios.appScheme = ios.appScheme || 'org.jitsi.meet';
  70. ios.downloadLink = ios.downloadLink
  71. || 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905';
  72. if (ios.dynamicLink) {
  73. ios.dynamicLink.apn = ios.dynamicLink.apn || 'org.jitsi.meet';
  74. ios.dynamicLink.appCode = ios.dynamicLink.appCode || 'w2atb';
  75. ios.dynamicLink.ibi = ios.dynamicLink.ibi || 'com.atlassian.JitsiMeet.ios';
  76. ios.dynamicLink.isi = ios.dynamicLink.isi || '1165103905';
  77. }
  78. android.appName = android.appName || 'Jitsi Meet';
  79. android.appScheme = android.appScheme || 'org.jitsi.meet';
  80. android.downloadLink = android.downloadLink
  81. || 'https://play.google.com/store/apps/details?id=org.jitsi.meet';
  82. android.appPackage = android.appPackage || 'org.jitsi.meet';
  83. android.fDroidUrl = android.fDroidUrl || 'https://f-droid.org/en/packages/org.jitsi.meet/';
  84. if (android.dynamicLink) {
  85. android.dynamicLink.apn = android.dynamicLink.apn || 'org.jitsi.meet';
  86. android.dynamicLink.appCode = android.dynamicLink.appCode || 'w2atb';
  87. android.dynamicLink.ibi = android.dynamicLink.ibi || 'com.atlassian.JitsiMeet.ios';
  88. android.dynamicLink.isi = android.dynamicLink.isi || '1165103905';
  89. }
  90. }