mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-12 18:39:58 +00:00
Remove popup deviceStore
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
import { hasRequiredCapabilities } from "../../cast/utils";
|
import { hasRequiredCapabilities } from "../../cast/utils";
|
||||||
|
|
||||||
import Receiver from "./Receiver.svelte";
|
import Receiver from "./Receiver.svelte";
|
||||||
import deviceStore from "./deviceStore";
|
|
||||||
|
|
||||||
const _ = browser.i18n.getMessage;
|
const _ = browser.i18n.getMessage;
|
||||||
|
|
||||||
@@ -25,6 +24,9 @@
|
|||||||
/** Media types available to select. */
|
/** Media types available to select. */
|
||||||
let availableMediaTypes = ReceiverSelectorMediaType.App;
|
let availableMediaTypes = ReceiverSelectorMediaType.App;
|
||||||
|
|
||||||
|
/** Devices to display. */
|
||||||
|
let devices: ReceiverDevice[] = [];
|
||||||
|
|
||||||
/** Sender app ID (if available). */
|
/** Sender app ID (if available). */
|
||||||
let appId: Optional<string>;
|
let appId: Optional<string>;
|
||||||
/** Page info (if launched from page context). */
|
/** Page info (if launched from page context). */
|
||||||
@@ -166,7 +168,7 @@
|
|||||||
|
|
||||||
updateKnownApp();
|
updateKnownApp();
|
||||||
|
|
||||||
$deviceStore = message.data.receiverDevices;
|
devices = message.data.receiverDevices;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -267,7 +269,7 @@
|
|||||||
|
|
||||||
// Match by index rendered receiver element to device array
|
// Match by index rendered receiver element to device array
|
||||||
if (receiverElementIndex > -1) {
|
if (receiverElementIndex > -1) {
|
||||||
return $deviceStore[receiverElementIndex];
|
return devices[receiverElementIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,12 +420,12 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<ul class="receiver-list">
|
<ul class="receiver-list">
|
||||||
{#if !$deviceStore.length}
|
{#if !devices.length}
|
||||||
<div class="receiver-list__not-found">
|
<div class="receiver-list__not-found">
|
||||||
{_("popupNoReceiversFound")}
|
{_("popupNoReceiversFound")}
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
{#each $deviceStore as device}
|
{#each devices as device}
|
||||||
<Receiver
|
<Receiver
|
||||||
{port}
|
{port}
|
||||||
{device}
|
{device}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="receiver__expand-button ghost"
|
class="receiver__expand-button ghost"
|
||||||
class:receiver__expand-button--expanded={isExpanded}
|
class:receiver__expand-button--expanded={isExpanded && mediaStatus}
|
||||||
title={_("popupShowDetailsTitle")}
|
title={_("popupShowDetailsTitle")}
|
||||||
disabled={!mediaStatus}
|
disabled={!mediaStatus}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
const _ = browser.i18n.getMessage;
|
const _ = browser.i18n.getMessage;
|
||||||
|
|
||||||
import deviceStore from "./deviceStore";
|
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{
|
const dispatch = createEventDispatcher<{
|
||||||
togglePlayback: void;
|
togglePlayback: void;
|
||||||
seek: { position: number };
|
seek: { position: number };
|
||||||
@@ -104,13 +102,10 @@
|
|||||||
let lastUpdateTime = 0;
|
let lastUpdateTime = 0;
|
||||||
let currentTime = getEstimatedMediaTime();
|
let currentTime = getEstimatedMediaTime();
|
||||||
|
|
||||||
deviceStore.subscribe(devices => {
|
$: if (device.mediaStatus?.currentTime) {
|
||||||
const newDevice = devices.find(newDevice => newDevice.id === device.id);
|
lastUpdateTime = 0;
|
||||||
if (newDevice?.mediaStatus?.currentTime) {
|
currentTime = device.mediaStatus.currentTime;
|
||||||
lastUpdateTime = Date.now();
|
}
|
||||||
currentTime = newDevice.mediaStatus.currentTime;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update estimated time every second
|
// Update estimated time every second
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
import { writable } from "svelte/store";
|
|
||||||
import type { ReceiverDevice } from "../../types";
|
|
||||||
|
|
||||||
export default writable<ReceiverDevice[]>([]);
|
|
||||||
Reference in New Issue
Block a user