From 1b4582fca0082c90152546a4c226e1dccc13abd5 Mon Sep 17 00:00:00 2001 From: Alexis Faizeau Date: Fri, 6 May 2022 15:45:10 +0200 Subject: [PATCH] Fix deny proximity meeting --- back/src/Model/User.ts | 1 + front/src/Phaser/Components/PlayerStatusDot.ts | 1 + front/src/Phaser/Game/GameScene.ts | 9 ++++----- .../src/Phaser/UserInput/GameSceneUserInputHandler.ts | 2 +- front/src/Phaser/UserInput/UserInputManager.ts | 2 +- front/src/Stores/MediaStore.ts | 11 ++++++++--- messages/protos/messages.proto | 1 + 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/back/src/Model/User.ts b/back/src/Model/User.ts index e6f4d39e..8efbce87 100644 --- a/back/src/Model/User.ts +++ b/back/src/Model/User.ts @@ -96,6 +96,7 @@ export class User implements Movable { public get silent(): boolean { return ( + this.availabilityStatus === AvailabilityStatus.DENY_PROXIMITY_MEETING || this.availabilityStatus === AvailabilityStatus.SILENT || this.availabilityStatus === AvailabilityStatus.JITSI ); diff --git a/front/src/Phaser/Components/PlayerStatusDot.ts b/front/src/Phaser/Components/PlayerStatusDot.ts index 75292aee..38cdb0ac 100644 --- a/front/src/Phaser/Components/PlayerStatusDot.ts +++ b/front/src/Phaser/Components/PlayerStatusDot.ts @@ -12,6 +12,7 @@ export class PlayerStatusDot extends Phaser.GameObjects.Container { [AvailabilityStatus.ONLINE]: { filling: 0x8cc43f, outline: 0x427a25 }, [AvailabilityStatus.SILENT]: { filling: 0xe74c3c, outline: 0xc0392b }, [AvailabilityStatus.JITSI]: { filling: 0x8cc43f, outline: 0x427a25 }, + [AvailabilityStatus.DENY_PROXIMITY_MEETING]: { filling: 0xffffff, outline: 0x404040 }, [AvailabilityStatus.UNRECOGNIZED]: { filling: 0xffffff, outline: 0xffffff }, [AvailabilityStatus.UNCHANGED]: { filling: 0xffffff, outline: 0xffffff }, }; diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 9c66dd7b..c6ff56f1 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -92,7 +92,7 @@ import { MapStore } from "../../Stores/Utils/MapStore"; import { followUsersColorStore } from "../../Stores/FollowStore"; import { GameSceneUserInputHandler } from "../UserInput/GameSceneUserInputHandler"; import LL, { locale } from "../../i18n/i18n-svelte"; -import { availabilityStatusStore, localVolumeStore } from "../../Stores/MediaStore"; +import { availabilityStatusStore, denyProximityMeetingStore, localVolumeStore } from "../../Stores/MediaStore"; import { StringUtils } from "../../Utils/StringUtils"; import { startLayerNamesStore } from "../../Stores/StartLayerNamesStore"; import { JitsiCoWebsite } from "../../WebRtc/CoWebsite/JitsiCoWebsite"; @@ -227,7 +227,6 @@ export class GameScene extends DirtyScene { private jitsiDominantSpeaker: boolean = false; private jitsiParticipantsCount: number = 0; public readonly superLoad: SuperLoaderPlugin; - private allowProximityMeeting: boolean = true; constructor(private room: Room, MapUrlFile: string, customKey?: string | undefined) { super({ @@ -1118,14 +1117,14 @@ ${escapedMessage} this.iframeSubscriptionList.push( iframeListener.disablePlayerProximityMeetingStream.subscribe(() => { - this.allowProximityMeeting = false; + denyProximityMeetingStore.set(true); this.disableMediaBehaviors(); }) ); this.iframeSubscriptionList.push( iframeListener.enablePlayerProximityMeetingStream.subscribe(() => { - this.allowProximityMeeting = true; + denyProximityMeetingStore.set(false); this.enableMediaBehaviors(); }) ); @@ -2191,7 +2190,7 @@ ${escapedMessage} } public enableMediaBehaviors() { - if (this.allowProximityMeeting) { + if (!get(denyProximityMeetingStore)) { mediaManager.showMyCamera(); } } diff --git a/front/src/Phaser/UserInput/GameSceneUserInputHandler.ts b/front/src/Phaser/UserInput/GameSceneUserInputHandler.ts index 7b8ce348..2c07a476 100644 --- a/front/src/Phaser/UserInput/GameSceneUserInputHandler.ts +++ b/front/src/Phaser/UserInput/GameSceneUserInputHandler.ts @@ -26,7 +26,7 @@ export class GameSceneUserInputHandler implements UserInputHandlerInterface { return; } - if (!this.gameScene.userInputManager.isControlsEnable()) { + if (!this.gameScene.userInputManager.isControlsEnabled) { return; } diff --git a/front/src/Phaser/UserInput/UserInputManager.ts b/front/src/Phaser/UserInput/UserInputManager.ts index 98e87bf3..ca98a25a 100644 --- a/front/src/Phaser/UserInput/UserInputManager.ts +++ b/front/src/Phaser/UserInput/UserInputManager.ts @@ -186,7 +186,7 @@ export class UserInputManager { this.isInputDisabled = false; } - isControlsEnable() { + get isControlsEnabled() { return !this.isInputDisabled; } diff --git a/front/src/Stores/MediaStore.ts b/front/src/Stores/MediaStore.ts index ea7eefb8..efa6d5dc 100644 --- a/front/src/Stores/MediaStore.ts +++ b/front/src/Stores/MediaStore.ts @@ -182,11 +182,13 @@ function createVideoConstraintStore() { export const inJitsiStore = writable(false); export const silentStore = writable(false); +export const denyProximityMeetingStore = writable(false); export const availabilityStatusStore = derived( - [inJitsiStore, silentStore, privacyShutdownStore], - ([$inJitsiStore, $silentStore, $privacyShutdownStore]) => { + [inJitsiStore, silentStore, privacyShutdownStore, denyProximityMeetingStore], + ([$inJitsiStore, $silentStore, $privacyShutdownStore, $denyProximityMeetingStore]) => { if ($inJitsiStore) return AvailabilityStatus.JITSI; + if ($denyProximityMeetingStore) return AvailabilityStatus.DENY_PROXIMITY_MEETING; if ($silentStore) return AvailabilityStatus.SILENT; if ($privacyShutdownStore) return AvailabilityStatus.AWAY; return AvailabilityStatus.ONLINE; @@ -320,7 +322,10 @@ export const mediaStreamConstraintsStore = derived( //currentAudioConstraint = false; } - if ($availabilityStatusStore === AvailabilityStatus.SILENT) { + if ( + $availabilityStatusStore === AvailabilityStatus.DENY_PROXIMITY_MEETING || + $availabilityStatusStore === AvailabilityStatus.SILENT + ) { currentVideoConstraint = false; currentAudioConstraint = false; } diff --git a/messages/protos/messages.proto b/messages/protos/messages.proto index d1a3eebf..a92477a8 100644 --- a/messages/protos/messages.proto +++ b/messages/protos/messages.proto @@ -10,6 +10,7 @@ enum AvailabilityStatus { SILENT = 2; AWAY = 3; JITSI = 4; + DENY_PROXIMITY_MEETING = 5; } message PositionMessage {