Type cleanup

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2020-12-26 18:10:50 +01:00
parent 322afe6450
commit 5779a543c9
No known key found for this signature in database
GPG key ID: 9760693FDD98A790
3 changed files with 18 additions and 22 deletions

View file

@ -66,6 +66,15 @@ declare global {
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 {
// https://developer.mozilla.org/en-US/docs/Web/API/Document/hasStorageAccess
hasStorageAccess?: () => Promise<boolean>;

View file

@ -84,12 +84,6 @@ import { CallError } from "matrix-js-sdk/src/webrtc/call";
import { logger } from 'matrix-js-sdk/src/logger';
import DesktopCapturerSourcePicker from "./components/views/elements/DesktopCapturerSourcePicker"
export interface ElectronDesktopCapturerSource {
display_id: string;
id: string;
name: string;
}
enum AudioID {
Ring = 'ringAudio',
Ringback = 'ringbackAudio',
@ -485,7 +479,7 @@ export default class CallHandler {
call.placeScreenSharingCall(
remoteElement,
localElement,
async (sources: Array<ElectronDesktopCapturerSource>) : Promise<ElectronDesktopCapturerSource> => {
async (sources: Array<DesktopCapturerSource>) : Promise<DesktopCapturerSource> => {
const {finished} = Modal.createDialog(DesktopCapturerSourcePicker, {sources});
const [source] = await finished;
return source;

View file

@ -24,19 +24,13 @@ export enum Tabs {
Screens = "screens",
Windows = "windows",
}
export interface ElectronDesktopCapturerSource {
display_id: string;
id: string;
name: string;
thumbnail,
appIcon,
}
export interface DesktopCapturerSourceIProps {
source: ElectronDesktopCapturerSource,
onSelect(source: ElectronDesktopCapturerSource): void,
source: DesktopCapturerSource,
onSelect(source: DesktopCapturerSource): void,
}
export class DesktopCapturerSource extends React.Component<DesktopCapturerSourceIProps> {
export class ExistingSource extends React.Component<DesktopCapturerSourceIProps> {
constructor(props) {
super(props);
}
@ -63,13 +57,12 @@ export class DesktopCapturerSource extends React.Component<DesktopCapturerSource
}
}
export interface DesktopCapturerSourcePickerIState {
selectedTab: Tabs;
}
export interface DesktopCapturerSourcePickerIProps {
sources: Array<ElectronDesktopCapturerSource>;
onFinished(source: ElectronDesktopCapturerSource): void,
sources: Array<DesktopCapturerSource>;
onFinished(source: DesktopCapturerSource): void,
}
// 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");
})
.map((source) => {
return <DesktopCapturerSource source={source} onSelect={this.onSelect} key={source.id} />;
return <ExistingSource source={source} onSelect={this.onSelect} key={source.id} />;
});
} else {
sources = this.props.sources
@ -118,7 +111,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<
return source.id.startsWith("window");
})
.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";