removed silentStore
This commit is contained in:
parent
61c68b0875
commit
7385ce522f
@ -95,7 +95,7 @@ export class User implements Movable {
|
||||
}
|
||||
|
||||
public get silent(): boolean {
|
||||
return this.status === AvailabilityStatus.SILENT;
|
||||
return this.status === AvailabilityStatus.SILENT || this.status === AvailabilityStatus.JITSI;
|
||||
}
|
||||
|
||||
get following(): User | undefined {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { isSilentStore, requestedCameraState, requestedMicrophoneState } from "../../Stores/MediaStore";
|
||||
import { availabilityStatusStore, requestedCameraState, requestedMicrophoneState } from "../../Stores/MediaStore";
|
||||
import { get } from "svelte/store";
|
||||
import { WorkAdventureDesktopApi } from "@wa-preload-app";
|
||||
import { AvailabilityStatus } from "../../Messages/ts-proto-generated/protos/messages";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@ -36,8 +37,8 @@ class DesktopApi {
|
||||
}
|
||||
});
|
||||
|
||||
isSilentStore.subscribe((value) => {
|
||||
this.isSilent = value;
|
||||
availabilityStatusStore.subscribe((status) => {
|
||||
this.isSilent = status === AvailabilityStatus.SILENT;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { requestedScreenSharingState, screenSharingAvailableStore } from "../Stores/ScreenSharingStore";
|
||||
import { isSilentStore, requestedCameraState, requestedMicrophoneState } from "../Stores/MediaStore";
|
||||
import { availabilityStatusStore, requestedCameraState, requestedMicrophoneState } from "../Stores/MediaStore";
|
||||
import monitorImg from "./images/monitor.svg";
|
||||
import monitorCloseImg from "./images/monitor-close.svg";
|
||||
import cinemaImg from "./images/cinema.svg";
|
||||
@ -18,6 +18,7 @@
|
||||
import { followRoleStore, followStateStore, followUsersStore } from "../Stores/FollowStore";
|
||||
import { gameManager } from "../Phaser/Game/GameManager";
|
||||
import { currentPlayerGroupLockStateStore } from "../Stores/CurrentPlayerGroupStore";
|
||||
import { AvailabilityStatus } from "../Messages/ts-proto-generated/protos/messages";
|
||||
|
||||
const gameScene = gameManager.getCurrentGameScene();
|
||||
|
||||
@ -77,8 +78,8 @@
|
||||
}
|
||||
|
||||
let isSilent: boolean;
|
||||
const unsubscribeIsSilent = isSilentStore.subscribe((value) => {
|
||||
isSilent = value;
|
||||
const unsubscribeIsSilent = availabilityStatusStore.subscribe((status) => {
|
||||
isSilent = status === AvailabilityStatus.SILENT;
|
||||
});
|
||||
onDestroy(unsubscribeIsSilent);
|
||||
</script>
|
||||
|
@ -1,10 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { localVolumeStore, obtainedMediaConstraintStore } from "../Stores/MediaStore";
|
||||
import { localStreamStore, isSilentStore } from "../Stores/MediaStore";
|
||||
import { availabilityStatusStore, localVolumeStore, obtainedMediaConstraintStore } from "../Stores/MediaStore";
|
||||
import { localStreamStore } from "../Stores/MediaStore";
|
||||
import SoundMeterWidget from "./SoundMeterWidget.svelte";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import { srcObject } from "./Video/utils";
|
||||
import LL from "../i18n/i18n-svelte";
|
||||
import { AvailabilityStatus } from "../Messages/ts-proto-generated/protos/messages";
|
||||
|
||||
let stream: MediaStream | null;
|
||||
|
||||
@ -21,8 +22,8 @@
|
||||
});
|
||||
|
||||
let isSilent: boolean;
|
||||
const unsubscribeIsSilent = isSilentStore.subscribe((value) => {
|
||||
isSilent = value;
|
||||
const unsubscribeIsSilent = availabilityStatusStore.subscribe((status) => {
|
||||
isSilent = status === AvailabilityStatus.SILENT;
|
||||
});
|
||||
|
||||
let cameraContainer: HTMLDivElement;
|
||||
|
@ -11,6 +11,7 @@ export class PlayerStatusDot extends Phaser.GameObjects.Container {
|
||||
[AvailabilityStatus.AWAY]: { filling: 0xf5931e, outline: 0x875d13 },
|
||||
[AvailabilityStatus.ONLINE]: { filling: 0x8cc43f, outline: 0x427a25 },
|
||||
[AvailabilityStatus.SILENT]: { filling: 0xe74c3c, outline: 0xc0392b },
|
||||
[AvailabilityStatus.JITSI]: { filling: 0x74b9ff, outline: 0x0984e3 },
|
||||
[AvailabilityStatus.UNRECOGNIZED]: { filling: 0xffffff, outline: 0xffffff },
|
||||
};
|
||||
|
||||
|
@ -9,7 +9,6 @@ import { Companion } from "../Companion/Companion";
|
||||
import type { GameScene } from "../Game/GameScene";
|
||||
import { DEPTH_INGAME_TEXT_INDEX } from "../Game/DepthIndexes";
|
||||
import type OutlinePipelinePlugin from "phaser3-rex-plugins/plugins/outlinepipeline-plugin.js";
|
||||
import { isSilentStore } from "../../Stores/MediaStore";
|
||||
import { lazyLoadPlayerCharacterTextures } from "./PlayerTexturesLoadingManager";
|
||||
import { TexturesHelper } from "../Helpers/TexturesHelper";
|
||||
import type { PictureStore } from "../../Stores/PictureStore";
|
||||
@ -356,14 +355,6 @@ export abstract class Character extends Container implements OutlineableInterfac
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
// TODO: Remove silent store and check for status?
|
||||
isSilent() {
|
||||
isSilentStore.set(true);
|
||||
}
|
||||
noSilent() {
|
||||
isSilentStore.set(false);
|
||||
}
|
||||
|
||||
playEmote(emote: string) {
|
||||
this.cancelPreviousEmote();
|
||||
const emoteY = -45;
|
||||
|
@ -18,6 +18,7 @@ import { iframeListener } from "../../Api/IframeListener";
|
||||
import { Room } from "../../Connexion/Room";
|
||||
import LL from "../../i18n/i18n-svelte";
|
||||
import { AvailabilityStatus } from "../../Messages/ts-proto-generated/protos/messages";
|
||||
import { availabilityStatusStore } from "../../Stores/MediaStore";
|
||||
|
||||
interface OpenCoWebsite {
|
||||
actionId: string;
|
||||
@ -66,6 +67,9 @@ export class GameMapPropertiesListener {
|
||||
coWebsiteManager.closeCoWebsite(coWebsite);
|
||||
}
|
||||
});
|
||||
this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.ONLINE);
|
||||
availabilityStatusStore.set(AvailabilityStatus.ONLINE);
|
||||
this.scene.CurrentPlayer.setStatus(AvailabilityStatus.ONLINE);
|
||||
} else {
|
||||
const openJitsiRoomFunction = () => {
|
||||
const roomName = jitsiFactory.getRoomName(newValue.toString(), this.scene.instance);
|
||||
@ -109,6 +113,9 @@ export class GameMapPropertiesListener {
|
||||
});
|
||||
} else {
|
||||
openJitsiRoomFunction();
|
||||
this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.JITSI);
|
||||
availabilityStatusStore.set(AvailabilityStatus.JITSI);
|
||||
this.scene.CurrentPlayer.setStatus(AvailabilityStatus.JITSI);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -146,12 +153,12 @@ export class GameMapPropertiesListener {
|
||||
this.gameMap.onPropertyChange(GameMapProperties.SILENT, (newValue) => {
|
||||
if (newValue === undefined || newValue === false || newValue === "") {
|
||||
this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.ONLINE);
|
||||
availabilityStatusStore.set(AvailabilityStatus.ONLINE);
|
||||
this.scene.CurrentPlayer.setStatus(AvailabilityStatus.ONLINE);
|
||||
this.scene.CurrentPlayer.noSilent();
|
||||
} else {
|
||||
this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.SILENT);
|
||||
availabilityStatusStore.set(AvailabilityStatus.SILENT);
|
||||
this.scene.CurrentPlayer.setStatus(AvailabilityStatus.SILENT);
|
||||
this.scene.CurrentPlayer.isSilent();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -91,7 +91,7 @@ import { MapStore } from "../../Stores/Utils/MapStore";
|
||||
import { followUsersColorStore } from "../../Stores/FollowStore";
|
||||
import { GameSceneUserInputHandler } from "../UserInput/GameSceneUserInputHandler";
|
||||
import { locale } from "../../i18n/i18n-svelte";
|
||||
import { localVolumeStore } from "../../Stores/MediaStore";
|
||||
import { availabilityStatusStore, localVolumeStore } from "../../Stores/MediaStore";
|
||||
import { StringUtils } from "../../Utils/StringUtils";
|
||||
import { startLayerNamesStore } from "../../Stores/StartLayerNamesStore";
|
||||
import { JitsiCoWebsite } from "../../WebRtc/CoWebsite/JitsiCoWebsite";
|
||||
@ -709,8 +709,9 @@ export class GameScene extends DirtyScene {
|
||||
});
|
||||
|
||||
this.privacyShutdownStoreUnsubscribe = privacyShutdownStore.subscribe((away) => {
|
||||
// TODO: Might be a problem with SILENT here
|
||||
this.connection?.emitPlayerStatusChange(away ? AvailabilityStatus.AWAY : AvailabilityStatus.ONLINE);
|
||||
const status = away ? AvailabilityStatus.AWAY : AvailabilityStatus.ONLINE;
|
||||
this.connection?.emitPlayerStatusChange(status);
|
||||
availabilityStatusStore.set(status);
|
||||
});
|
||||
|
||||
Promise.all([
|
||||
@ -2153,16 +2154,16 @@ ${escapedMessage}
|
||||
}
|
||||
|
||||
public enableMediaBehaviors() {
|
||||
const silent = this.gameMap.getCurrentProperties().get(GameMapProperties.SILENT);
|
||||
const status = silent ? AvailabilityStatus.SILENT : AvailabilityStatus.ONLINE;
|
||||
this.connection?.emitPlayerStatusChange(status);
|
||||
this.CurrentPlayer.setStatus(status);
|
||||
// const silent = this.gameMap.getCurrentProperties().get(GameMapProperties.SILENT);
|
||||
// const status = silent ? AvailabilityStatus.SILENT : AvailabilityStatus.ONLINE;
|
||||
// this.connection?.emitPlayerStatusChange(status);
|
||||
// this.CurrentPlayer.setStatus(status);
|
||||
mediaManager.showMyCamera();
|
||||
}
|
||||
|
||||
public disableMediaBehaviors() {
|
||||
this.connection?.emitPlayerStatusChange(AvailabilityStatus.SILENT);
|
||||
this.CurrentPlayer.setStatus(AvailabilityStatus.SILENT);
|
||||
// this.connection?.emitPlayerStatusChange(AvailabilityStatus.SILENT);
|
||||
// this.CurrentPlayer.setStatus(AvailabilityStatus.SILENT);
|
||||
mediaManager.hideMyCamera();
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import { peerStore } from "./PeerStore";
|
||||
import { privacyShutdownStore } from "./PrivacyShutdownStore";
|
||||
import { MediaStreamConstraintsError } from "./Errors/MediaStreamConstraintsError";
|
||||
import { SoundMeter } from "../Phaser/Components/SoundMeter";
|
||||
import { AvailabilityStatus } from "../Messages/ts-proto-generated/protos/messages";
|
||||
|
||||
/**
|
||||
* A store that contains the camera state requested by the user (on or off).
|
||||
@ -178,10 +179,7 @@ function createVideoConstraintStore() {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A store containing if user is silent, so if he is in silent zone. This permit to show et hide camera of user
|
||||
*/
|
||||
export const isSilentStore = writable(false);
|
||||
export const availabilityStatusStore = writable(AvailabilityStatus.ONLINE);
|
||||
|
||||
export const videoConstraintStore = createVideoConstraintStore();
|
||||
|
||||
@ -240,7 +238,7 @@ export const mediaStreamConstraintsStore = derived(
|
||||
audioConstraintStore,
|
||||
privacyShutdownStore,
|
||||
cameraEnergySavingStore,
|
||||
isSilentStore,
|
||||
availabilityStatusStore,
|
||||
],
|
||||
(
|
||||
[
|
||||
@ -252,7 +250,7 @@ export const mediaStreamConstraintsStore = derived(
|
||||
$audioConstraintStore,
|
||||
$privacyShutdownStore,
|
||||
$cameraEnergySavingStore,
|
||||
$isSilentStore,
|
||||
$availabilityStatusStore,
|
||||
],
|
||||
set
|
||||
) => {
|
||||
@ -309,7 +307,7 @@ export const mediaStreamConstraintsStore = derived(
|
||||
//currentAudioConstraint = false;
|
||||
}
|
||||
|
||||
if ($isSilentStore === true) {
|
||||
if ($availabilityStatusStore === AvailabilityStatus.SILENT) {
|
||||
currentVideoConstraint = false;
|
||||
currentAudioConstraint = false;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ enum AvailabilityStatus {
|
||||
ONLINE = 0;
|
||||
SILENT = 1;
|
||||
AWAY = 2;
|
||||
JITSI = 3;
|
||||
}
|
||||
|
||||
message PositionMessage {
|
||||
|
Loading…
Reference in New Issue
Block a user