Type cleanup
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
322afe6450
commit
5779a543c9
3 changed files with 18 additions and 22 deletions
9
src/@types/global.d.ts
vendored
9
src/@types/global.d.ts
vendored
|
@ -66,6 +66,15 @@ declare global {
|
||||||
mxModalWidgetStore: ModalWidgetStore;
|
mxModalWidgetStore: ModalWidgetStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DesktopCapturerSource {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
thumbnail;
|
||||||
|
// This property is not camelcase and isn't used, therefore it is commented
|
||||||
|
//display_id: string;
|
||||||
|
appIcon;
|
||||||
|
}
|
||||||
|
|
||||||
interface Document {
|
interface Document {
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/Document/hasStorageAccess
|
// https://developer.mozilla.org/en-US/docs/Web/API/Document/hasStorageAccess
|
||||||
hasStorageAccess?: () => Promise<boolean>;
|
hasStorageAccess?: () => Promise<boolean>;
|
||||||
|
|
|
@ -84,12 +84,6 @@ import { CallError } from "matrix-js-sdk/src/webrtc/call";
|
||||||
import { logger } from 'matrix-js-sdk/src/logger';
|
import { logger } from 'matrix-js-sdk/src/logger';
|
||||||
import DesktopCapturerSourcePicker from "./components/views/elements/DesktopCapturerSourcePicker"
|
import DesktopCapturerSourcePicker from "./components/views/elements/DesktopCapturerSourcePicker"
|
||||||
|
|
||||||
export interface ElectronDesktopCapturerSource {
|
|
||||||
display_id: string;
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum AudioID {
|
enum AudioID {
|
||||||
Ring = 'ringAudio',
|
Ring = 'ringAudio',
|
||||||
Ringback = 'ringbackAudio',
|
Ringback = 'ringbackAudio',
|
||||||
|
@ -485,7 +479,7 @@ export default class CallHandler {
|
||||||
call.placeScreenSharingCall(
|
call.placeScreenSharingCall(
|
||||||
remoteElement,
|
remoteElement,
|
||||||
localElement,
|
localElement,
|
||||||
async (sources: Array<ElectronDesktopCapturerSource>) : Promise<ElectronDesktopCapturerSource> => {
|
async (sources: Array<DesktopCapturerSource>) : Promise<DesktopCapturerSource> => {
|
||||||
const {finished} = Modal.createDialog(DesktopCapturerSourcePicker, {sources});
|
const {finished} = Modal.createDialog(DesktopCapturerSourcePicker, {sources});
|
||||||
const [source] = await finished;
|
const [source] = await finished;
|
||||||
return source;
|
return source;
|
||||||
|
|
|
@ -24,19 +24,13 @@ export enum Tabs {
|
||||||
Screens = "screens",
|
Screens = "screens",
|
||||||
Windows = "windows",
|
Windows = "windows",
|
||||||
}
|
}
|
||||||
export interface ElectronDesktopCapturerSource {
|
|
||||||
display_id: string;
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
thumbnail,
|
|
||||||
appIcon,
|
|
||||||
}
|
|
||||||
export interface DesktopCapturerSourceIProps {
|
export interface DesktopCapturerSourceIProps {
|
||||||
source: ElectronDesktopCapturerSource,
|
source: DesktopCapturerSource,
|
||||||
onSelect(source: ElectronDesktopCapturerSource): void,
|
onSelect(source: DesktopCapturerSource): void,
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DesktopCapturerSource extends React.Component<DesktopCapturerSourceIProps> {
|
export class ExistingSource extends React.Component<DesktopCapturerSourceIProps> {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
}
|
}
|
||||||
|
@ -63,13 +57,12 @@ export class DesktopCapturerSource extends React.Component<DesktopCapturerSource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface DesktopCapturerSourcePickerIState {
|
export interface DesktopCapturerSourcePickerIState {
|
||||||
selectedTab: Tabs;
|
selectedTab: Tabs;
|
||||||
}
|
}
|
||||||
export interface DesktopCapturerSourcePickerIProps {
|
export interface DesktopCapturerSourcePickerIProps {
|
||||||
sources: Array<ElectronDesktopCapturerSource>;
|
sources: Array<DesktopCapturerSource>;
|
||||||
onFinished(source: ElectronDesktopCapturerSource): void,
|
onFinished(source: DesktopCapturerSource): void,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Figure out a way to update sources for live preview
|
// TODO: Figure out a way to update sources for live preview
|
||||||
|
@ -110,7 +103,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<
|
||||||
return source.id.startsWith("screen");
|
return source.id.startsWith("screen");
|
||||||
})
|
})
|
||||||
.map((source) => {
|
.map((source) => {
|
||||||
return <DesktopCapturerSource source={source} onSelect={this.onSelect} key={source.id} />;
|
return <ExistingSource source={source} onSelect={this.onSelect} key={source.id} />;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
sources = this.props.sources
|
sources = this.props.sources
|
||||||
|
@ -118,7 +111,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<
|
||||||
return source.id.startsWith("window");
|
return source.id.startsWith("window");
|
||||||
})
|
})
|
||||||
.map((source) => {
|
.map((source) => {
|
||||||
return <DesktopCapturerSource source={source} onSelect={this.onSelect} key={source.id} />;
|
return <ExistingSource source={source} onSelect={this.onSelect} key={source.id} />;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const buttonStyle = "mx_streamSelectorDialog_tabLabel";
|
const buttonStyle = "mx_streamSelectorDialog_tabLabel";
|
||||||
|
|
Loading…
Reference in a new issue