Przeglądaj źródła

fix(config): Document desktopSharingSources and improve types

factor2
Hristo Terezov 5 miesięcy temu
rodzic
commit
35554533d1

+ 3
- 0
config.js Wyświetl plik

@@ -1631,6 +1631,9 @@ var config = {
1631 1631
     //         video: true
1632 1632
     //     },
1633 1633
     // },
1634
+    // The default type of desktop sharing sources that will be used in the electron app.
1635
+    // desktopSharingSources: ['screen', 'window'],
1636
+
1634 1637
     // Disables the echo cancelation for local audio tracks.
1635 1638
     // disableAEC: true,
1636 1639
 

+ 2
- 0
react/features/base/config/configType.ts Wyświetl plik

@@ -1,5 +1,6 @@
1 1
 import { ToolbarButton } from '../../toolbox/types';
2 2
 import { ILoggingConfig } from '../logging/types';
3
+import { DesktopSharingSourceType } from '../tracks/types';
3 4
 
4 5
 type ButtonsWithNotifyClick = 'camera' |
5 6
     'chat' |
@@ -280,6 +281,7 @@ export interface IConfig {
280 281
         max?: number;
281 282
         min?: number;
282 283
     };
284
+    desktopSharingSources?: Array<DesktopSharingSourceType>;
283 285
     dialInConfCodeUrl?: string;
284 286
     dialInNumbersUrl?: string;
285 287
     dialOutAuthUrl?: string;

+ 4
- 2
react/features/base/tracks/types.ts Wyświetl plik

@@ -12,7 +12,7 @@ export interface ITrackOptions {
12 12
         };
13 13
     };
14 14
     desktopSharingSourceDevice?: string;
15
-    desktopSharingSources?: string[];
15
+    desktopSharingSources?: Array<DesktopSharingSourceType>;
16 16
     devices?: string[];
17 17
     facingMode?: string;
18 18
     micDeviceId?: string | null;
@@ -67,9 +67,11 @@ export interface IToggleScreenSharingOptions {
67 67
     shareOptions: IShareOptions;
68 68
 }
69 69
 
70
+export type DesktopSharingSourceType = 'screen' | 'window';
71
+
70 72
 export interface IShareOptions {
71 73
     desktopSharingSourceDevice?: string;
72
-    desktopSharingSources?: string[];
74
+    desktopSharingSources?: Array<DesktopSharingSourceType>;
73 75
     desktopStream?: any;
74 76
 }
75 77
 

+ 6
- 1
react/features/desktop-picker/actions.ts Wyświetl plik

@@ -1,7 +1,12 @@
1 1
 import { openDialog } from '../base/dialog/actions';
2
+import { DesktopSharingSourceType } from '../base/tracks/types';
2 3
 
3 4
 import DesktopPicker from './components/DesktopPicker';
4 5
 
6
+type Options = {
7
+    desktopSharingSources?: Array<DesktopSharingSourceType>;
8
+};
9
+
5 10
 /**
6 11
  * Signals to open a dialog with the DesktopPicker component.
7 12
  *
@@ -10,7 +15,7 @@ import DesktopPicker from './components/DesktopPicker';
10 15
  * a DesktopCapturerSource has been chosen.
11 16
  * @returns {Object}
12 17
  */
13
-export function showDesktopPicker(options: { desktopSharingSources?: any; } = {}, onSourceChoose: Function) {
18
+export function showDesktopPicker(options: Options = {}, onSourceChoose: Function) {
14 19
     const { desktopSharingSources } = options;
15 20
 
16 21
     return openDialog(DesktopPicker, {

+ 7
- 6
react/features/desktop-picker/components/DesktopPicker.tsx Wyświetl plik

@@ -5,6 +5,7 @@ import { connect } from 'react-redux';
5 5
 import { IStore } from '../../app/types';
6 6
 import { hideDialog } from '../../base/dialog/actions';
7 7
 import { translate } from '../../base/i18n/functions';
8
+import { DesktopSharingSourceType } from '../../base/tracks/types';
8 9
 import Dialog from '../../base/ui/components/web/Dialog';
9 10
 import Tabs from '../../base/ui/components/web/Tabs';
10 11
 import { THUMBNAIL_SIZE } from '../constants';
@@ -32,7 +33,7 @@ const TAB_LABELS = {
32 33
     window: 'dialog.applicationWindow'
33 34
 };
34 35
 
35
-const VALID_TYPES = Object.keys(TAB_LABELS);
36
+const VALID_TYPES = Object.keys(TAB_LABELS) as DesktopSharingSourceType[];
36 37
 
37 38
 /**
38 39
  * The type of the React {@code Component} props of {@link DesktopPicker}.
@@ -42,7 +43,7 @@ interface IProps extends WithTranslation {
42 43
     /**
43 44
      * An array with desktop sharing sources to be displayed.
44 45
      */
45
-    desktopSharingSources: Array<string>;
46
+    desktopSharingSources: Array<DesktopSharingSourceType>;
46 47
 
47 48
     /**
48 49
      * Used to request DesktopCapturerSources.
@@ -84,7 +85,7 @@ interface IState {
84 85
     /**
85 86
      * The desktop source types to fetch previews for.
86 87
      */
87
-    types: Array<string>;
88
+    types: Array<DesktopSharingSourceType>;
88 89
 }
89 90
 
90 91
 
@@ -112,7 +113,7 @@ class DesktopPicker extends PureComponent<IProps, IState> {
112 113
      * @private
113 114
      * @returns {Array<string>} The filtered types.
114 115
      */
115
-    static _getValidTypes(types: string[] = []) {
116
+    static _getValidTypes(types: DesktopSharingSourceType[] = []) {
116 117
         return types.filter(
117 118
             type => VALID_TYPES.includes(type));
118 119
     }
@@ -346,10 +347,10 @@ class DesktopPicker extends PureComponent<IProps, IState> {
346 347
             = types.map(
347 348
                 type => {
348 349
                     return {
349
-                        accessibilityLabel: t(TAB_LABELS[type as keyof typeof TAB_LABELS]),
350
+                        accessibilityLabel: t(TAB_LABELS[type]),
350 351
                         id: `${type}`,
351 352
                         controlsId: `${type}-panel`,
352
-                        label: t(TAB_LABELS[type as keyof typeof TAB_LABELS])
353
+                        label: t(TAB_LABELS[type])
353 354
                     };
354 355
                 });
355 356
 

Ładowanie…
Anuluj
Zapisz