From 514b3823449832e279ceb37893074e3a44444e18 Mon Sep 17 00:00:00 2001 From: hensm Date: Mon, 18 Apr 2022 02:47:10 +0100 Subject: [PATCH] Move CastManager to cast/ --- ext/src/background/background.ts | 2 +- .../receiverSelector/ReceiverSelectorManager.ts | 2 +- ext/src/{background => cast}/CastManager.ts | 8 ++++---- ext/src/cast/export.ts | 4 +--- ext/src/lib/loadSender.ts | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) rename ext/src/{background => cast}/CastManager.ts (98%) diff --git a/ext/src/background/background.ts b/ext/src/background/background.ts index afc8dde..f907914 100755 --- a/ext/src/background/background.ts +++ b/ext/src/background/background.ts @@ -8,7 +8,7 @@ import bridge, { BridgeInfo } from "../lib/bridge"; import { RemoteMatchPattern } from "../lib/matchPattern"; -import CastManager from "./CastManager"; +import CastManager from "../cast/CastManager"; import receiverDevices from "./receiverDevices"; import ReceiverSelectorManager from "./receiverSelector/ReceiverSelectorManager"; diff --git a/ext/src/background/receiverSelector/ReceiverSelectorManager.ts b/ext/src/background/receiverSelector/ReceiverSelectorManager.ts index a7f3212..40317e3 100644 --- a/ext/src/background/receiverSelector/ReceiverSelectorManager.ts +++ b/ext/src/background/receiverSelector/ReceiverSelectorManager.ts @@ -3,7 +3,7 @@ import options from "../../lib/options"; import logger from "../../lib/logger"; -import CastManager from "../CastManager"; +import CastManager from "../../cast/CastManager"; import receiverDevices from "../receiverDevices"; import { getMediaTypesForPageUrl } from "../../lib/utils"; diff --git a/ext/src/background/CastManager.ts b/ext/src/cast/CastManager.ts similarity index 98% rename from ext/src/background/CastManager.ts rename to ext/src/cast/CastManager.ts index 145dcc6..5d18c2e 100644 --- a/ext/src/background/CastManager.ts +++ b/ext/src/cast/CastManager.ts @@ -9,11 +9,11 @@ import options from "../lib/options"; import { ReceiverSelectionActionType, ReceiverSelectorMediaType -} from "./receiverSelector"; +} from "../background/receiverSelector"; -import ReceiverSelectorManager from "./receiverSelector/ReceiverSelectorManager"; +import ReceiverSelectorManager from "../background/receiverSelector/ReceiverSelectorManager"; -import receiverDevices from "./receiverDevices"; +import receiverDevices from "../background/receiverDevices"; type AnyPort = Port | MessagePort; @@ -143,7 +143,7 @@ export default new (class CastManager { /** * If there's already an active instance for the sender * tab/frame ID, disconnect it. - * + * * TODO: Fix this behaviour! */ for (const instance of this.activeInstances) { diff --git a/ext/src/cast/export.ts b/ext/src/cast/export.ts index 41c1827..2461d5e 100644 --- a/ext/src/cast/export.ts +++ b/ext/src/cast/export.ts @@ -45,9 +45,7 @@ export function ensureInit(): Promise> { * URL. */ if (window.location.protocol === "moz-extension:") { - const { default: CastManager } = await import( - "../background/CastManager" - ); + const { default: CastManager } = await import("./CastManager"); // port2 will post bridge messages to port 1 await CastManager.init(); diff --git a/ext/src/lib/loadSender.ts b/ext/src/lib/loadSender.ts index 6bc7180..76be275 100644 --- a/ext/src/lib/loadSender.ts +++ b/ext/src/lib/loadSender.ts @@ -9,7 +9,7 @@ import { ReceiverSelectorMediaType } from "../background/receiverSelector"; -import CastManager from "../background/CastManager"; +import CastManager from "../cast/CastManager"; interface LoadSenderOptions { tabId: number;