mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 09:39:58 +00:00
Fix unused locals and better receiver selector available media checking
This commit is contained in:
@@ -16,7 +16,6 @@ export default class PopupReceiverSelector
|
||||
implements ReceiverSelector {
|
||||
|
||||
private windowId: number;
|
||||
private openerWindowId: number;
|
||||
|
||||
private messagePort: browser.runtime.Port;
|
||||
private messagePortDisconnected: boolean;
|
||||
@@ -102,7 +101,6 @@ export default class PopupReceiverSelector
|
||||
this._isOpen = true;
|
||||
|
||||
this.windowId = popup.id;
|
||||
this.openerWindowId = openerWindow.id;
|
||||
|
||||
// Size/position not set correctly on creation (bug?)
|
||||
await browser.windows.update(this.windowId, {
|
||||
@@ -168,7 +166,6 @@ export default class PopupReceiverSelector
|
||||
|
||||
// Cleanup
|
||||
this.windowId = null;
|
||||
this.openerWindowId = null;
|
||||
this.messagePort = null;
|
||||
this.receivers = null;
|
||||
this.defaultMediaType = null;
|
||||
|
||||
@@ -83,6 +83,29 @@ async function getSelection (
|
||||
});
|
||||
|
||||
|
||||
const opts = await options.getAll();
|
||||
|
||||
// Remove mirroring media types if mirroring is not enabled.
|
||||
if (!opts.mirroringEnabled) {
|
||||
availableMediaTypes &= ~(
|
||||
ReceiverSelectorMediaType.Tab
|
||||
| ReceiverSelectorMediaType.Screen);
|
||||
}
|
||||
|
||||
// Remove file media type if local media is not enabled
|
||||
if (!opts.mediaEnabled || !opts.localMediaEnabled) {
|
||||
availableMediaTypes &= ~ReceiverSelectorMediaType.File;
|
||||
}
|
||||
|
||||
if (!availableMediaTypes || availableMediaTypes
|
||||
=== ReceiverSelectorMediaType.File) {
|
||||
console.error("fx_cast (Debug): No available media types");
|
||||
resolve(null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Ensure status manager is initialized
|
||||
await StatusManager.init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user