From fb9f8adb21c1d71845374816881c675bd0d3a65f Mon Sep 17 00:00:00 2001 From: Alexis Faizeau Date: Mon, 2 May 2022 14:25:43 +0200 Subject: [PATCH] Fix error on undefined path of desktop app interfaces --- front/src/Api/desktop/index.ts | 2 +- .../Video/DesktopCapturerSourcePicker.svelte | 2 +- front/src/Interfaces/DesktopAppInterfaces.ts | 21 +++++++++++++ front/src/Stores/ScreenSharingStore.ts | 2 +- front/tsconfig.json | 31 +++++++------------ 5 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 front/src/Interfaces/DesktopAppInterfaces.ts diff --git a/front/src/Api/desktop/index.ts b/front/src/Api/desktop/index.ts index 239ec8cf..c841037e 100644 --- a/front/src/Api/desktop/index.ts +++ b/front/src/Api/desktop/index.ts @@ -1,6 +1,6 @@ import { requestedCameraState, requestedMicrophoneState, silentStore } from "../../Stores/MediaStore"; import { get } from "svelte/store"; -import { WorkAdventureDesktopApi } from "@wa-preload-app"; +import { WorkAdventureDesktopApi } from "../../Interfaces/DesktopAppInterfaces"; declare global { interface Window { diff --git a/front/src/Components/Video/DesktopCapturerSourcePicker.svelte b/front/src/Components/Video/DesktopCapturerSourcePicker.svelte index 92eb41ae..b5ee960b 100644 --- a/front/src/Components/Video/DesktopCapturerSourcePicker.svelte +++ b/front/src/Components/Video/DesktopCapturerSourcePicker.svelte @@ -5,7 +5,7 @@ showDesktopCapturerSourcePicker, } from "../../Stores/ScreenSharingStore"; import { onDestroy, onMount } from "svelte"; - import type { DesktopCapturerSource } from "@wa-preload-app"; + import type { DesktopCapturerSource } from "../../Interfaces/DesktopAppInterfaces"; let desktopCapturerSources: DesktopCapturerSource[] = []; let interval: ReturnType; diff --git a/front/src/Interfaces/DesktopAppInterfaces.ts b/front/src/Interfaces/DesktopAppInterfaces.ts new file mode 100644 index 00000000..4069f7de --- /dev/null +++ b/front/src/Interfaces/DesktopAppInterfaces.ts @@ -0,0 +1,21 @@ +// copy of Electron.SourcesOptions to avoid Electron dependency in front +export interface SourcesOptions { + types: string[]; + thumbnailSize?: { height: number; width: number }; +} + +export interface DesktopCapturerSource { + id: string; + name: string; + thumbnailURL: string; +} + +export type WorkAdventureDesktopApi = { + desktop: boolean; + isDevelopment: () => Promise; + getVersion: () => Promise; + notify: (txt: string) => void; + onMuteToggle: (callback: () => void) => void; + onCameraToggle: (callback: () => void) => void; + getDesktopCapturerSources: (options: SourcesOptions) => Promise; +}; diff --git a/front/src/Stores/ScreenSharingStore.ts b/front/src/Stores/ScreenSharingStore.ts index 843e6212..8bf54c10 100644 --- a/front/src/Stores/ScreenSharingStore.ts +++ b/front/src/Stores/ScreenSharingStore.ts @@ -2,7 +2,7 @@ import { derived, Readable, readable, writable } from "svelte/store"; import { peerStore } from "./PeerStore"; import type { LocalStreamStoreValue } from "./MediaStore"; import { myCameraVisibilityStore } from "./MyCameraStoreVisibility"; -import type { DesktopCapturerSource } from "@wa-preload-app"; +import type { DesktopCapturerSource } from "../Interfaces/DesktopAppInterfaces"; declare const navigator: any; // eslint-disable-line @typescript-eslint/no-explicit-any diff --git a/front/tsconfig.json b/front/tsconfig.json index e5ac9819..66127d6f 100644 --- a/front/tsconfig.json +++ b/front/tsconfig.json @@ -1,6 +1,5 @@ { -// "include": ["src/**/*"], - + // "include": ["src/**/*"], "extends": "@tsconfig/svelte/tsconfig.json", "compilerOptions": { "outDir": "./dist/", @@ -14,23 +13,17 @@ "jsx": "react", "allowJs": true, "esModuleInterop": true, - "importsNotUsedAsValues": "remove", - - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - "strictNullChecks": true, /* Enable strict null checks. */ - "strictFunctionTypes": true, /* Enable strict checking of function types. */ - "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - "paths": { - "@wa-preload-app": ["../desktop/electron/src/preload-app/types.ts"], - } + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + "strictNullChecks": true, /* Enable strict null checks. */ + "strictFunctionTypes": true, /* Enable strict checking of function types. */ + "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ }, "exclude": [ "node_modules", @@ -38,4 +31,4 @@ "public/iframe_api.js", "packages/iframe-api-typings" ] -} +} \ No newline at end of file