diff --git a/back/src/Model/GameRoom.ts b/back/src/Model/GameRoom.ts index 5b1e13bf..f0c6e627 100644 --- a/back/src/Model/GameRoom.ts +++ b/back/src/Model/GameRoom.ts @@ -144,9 +144,8 @@ export class GameRoom { joinRoomMessage.getUseruuid(), joinRoomMessage.getIpaddress(), position, - false, this.positionNotifier, - joinRoomMessage.getAway(), + joinRoomMessage.getStatus(), socket, joinRoomMessage.getTagList(), joinRoomMessage.getVisitcardurl(), @@ -208,6 +207,9 @@ export class GameRoom { updatePlayerDetails(user: User, playerDetailsMessage: SetPlayerDetailsMessage) { user.updateDetails(playerDetailsMessage); + if (user.group !== undefined && user.silent) { + this.leaveGroup(user); + } } private updateUserGroup(user: User): void { @@ -345,21 +347,6 @@ export class GameRoom { }); } - setSilent(user: User, silent: boolean) { - if (user.silent === silent) { - return; - } - - user.silent = silent; - if (silent && user.group !== undefined) { - this.leaveGroup(user); - } - if (!silent) { - // If we are back to life, let's trigger a position update to see if we can join some group. - this.updatePosition(user, user.getPosition()); - } - } - /** * Makes a user leave a group and closes and destroy the group if the group contains only one remaining person. * diff --git a/back/src/Model/User.ts b/back/src/Model/User.ts index 7a6a53f1..b103f240 100644 --- a/back/src/Model/User.ts +++ b/back/src/Model/User.ts @@ -5,6 +5,7 @@ import { Movable } from "../Model/Movable"; import { PositionNotifier } from "../Model/PositionNotifier"; import { ServerDuplexStream } from "grpc"; import { + AvailabilityStatus, BatchMessage, CompanionMessage, FollowAbortMessage, @@ -30,9 +31,8 @@ export class User implements Movable { public readonly uuid: string, public readonly IPAddress: string, private position: PointInterface, - public silent: boolean, private positionNotifier: PositionNotifier, - private away: boolean, + private status: AvailabilityStatus, public readonly socket: UserSocket, public readonly tags: string[], public readonly visitCardUrl: string | null, @@ -90,8 +90,12 @@ export class User implements Movable { return this.outlineColor; } - public isAway(): boolean { - return this.away; + public getStatus(): AvailabilityStatus { + return this.status; + } + + public get silent(): boolean { + return this.status === AvailabilityStatus.SILENT || this.status === AvailabilityStatus.JITSI; } get following(): User | undefined { @@ -134,9 +138,11 @@ export class User implements Movable { } this.voiceIndicatorShown = details.getShowvoiceindicator()?.getValue(); - const away = details.getAway(); - if (away) { - this.away = away.getValue(); + const status = details.getStatus(); + let sendStatusUpdate = false; + if (status && status !== this.status) { + this.status = status; + sendStatusUpdate = true; } const playerDetails = new SetPlayerDetailsMessage(); @@ -147,8 +153,8 @@ export class User implements Movable { if (this.voiceIndicatorShown !== undefined) { playerDetails.setShowvoiceindicator(new BoolValue().setValue(this.voiceIndicatorShown)); } - if (details.getAway() !== undefined) { - playerDetails.setAway(new BoolValue().setValue(this.away)); + if (sendStatusUpdate) { + playerDetails.setStatus(details.getStatus()); } this.positionNotifier.updatePlayerDetails(this, playerDetails); diff --git a/back/src/RoomManager.ts b/back/src/RoomManager.ts index c07d7e76..7211facb 100644 --- a/back/src/RoomManager.ts +++ b/back/src/RoomManager.ts @@ -22,7 +22,6 @@ import { SendUserMessage, ServerToAdminClientMessage, SetPlayerDetailsMessage, - SilentMessage, UserMovesMessage, VariableMessage, WebRtcSignalToServerMessage, @@ -80,8 +79,6 @@ const roomManager: IRoomManagerServer = { user, message.getUsermovesmessage() as UserMovesMessage ); - } else if (message.hasSilentmessage()) { - socketManager.handleSilentMessage(room, user, message.getSilentmessage() as SilentMessage); } else if (message.hasItemeventmessage()) { socketManager.handleItemEvent( room, diff --git a/back/src/Services/SocketManager.ts b/back/src/Services/SocketManager.ts index c186658f..8d71f4d8 100644 --- a/back/src/Services/SocketManager.ts +++ b/back/src/Services/SocketManager.ts @@ -5,7 +5,6 @@ import { PointMessage, RoomJoinedMessage, ServerToClientMessage, - SilentMessage, SubMessage, UserMovedMessage, UserMovesMessage, @@ -160,10 +159,6 @@ export class SocketManager { room.updatePlayerDetails(user, playerDetailsMessage); } - handleSilentMessage(room: GameRoom, user: User, silentMessage: SilentMessage) { - room.setSilent(user, silentMessage.getSilent()); - } - handleItemEvent(room: GameRoom, user: User, itemEventMessage: ItemEventMessage) { const itemEvent = ProtobufUtils.toItemEvent(itemEventMessage); @@ -328,7 +323,7 @@ export class SocketManager { userJoinedZoneMessage.setUserid(thing.id); userJoinedZoneMessage.setUseruuid(thing.uuid); userJoinedZoneMessage.setName(thing.name); - userJoinedZoneMessage.setAway(thing.isAway()); + userJoinedZoneMessage.setStatus(thing.getStatus()); userJoinedZoneMessage.setCharacterlayersList(ProtobufUtils.toCharacterLayerMessages(thing.characterLayers)); userJoinedZoneMessage.setPosition(ProtobufUtils.toPositionMessage(thing.getPosition())); userJoinedZoneMessage.setFromzone(this.toProtoZone(fromZone)); @@ -656,7 +651,7 @@ export class SocketManager { userJoinedMessage.setUserid(thing.id); userJoinedMessage.setUseruuid(thing.uuid); userJoinedMessage.setName(thing.name); - userJoinedMessage.setAway(thing.isAway()); + userJoinedMessage.setStatus(thing.getStatus()); userJoinedMessage.setCharacterlayersList(ProtobufUtils.toCharacterLayerMessages(thing.characterLayers)); userJoinedMessage.setPosition(ProtobufUtils.toPositionMessage(thing.getPosition())); if (thing.visitCardUrl) { diff --git a/back/tests/PositionNotifierTest.ts b/back/tests/PositionNotifierTest.ts index a5af48f8..70e4c0a0 100644 --- a/back/tests/PositionNotifierTest.ts +++ b/back/tests/PositionNotifierTest.ts @@ -6,6 +6,7 @@ import { Zone } from "../src/Model/Zone"; import { Movable } from "../src/Model/Movable"; import { PositionInterface } from "../src/Model/PositionInterface"; import { ZoneSocket } from "../src/RoomManager"; +import { AvailabilityStatus } from "../src/Messages/generated/messages_pb"; describe("PositionNotifier", () => { it("should receive notifications when player moves", () => { @@ -40,9 +41,8 @@ describe("PositionNotifier", () => { moving: false, direction: "down", }, - false, positionNotifier, - false, + AvailabilityStatus.ONLINE, {} as UserSocket, [], null, @@ -60,9 +60,8 @@ describe("PositionNotifier", () => { moving: false, direction: "down", }, - false, positionNotifier, - false, + AvailabilityStatus.ONLINE, {} as UserSocket, [], null, @@ -150,9 +149,8 @@ describe("PositionNotifier", () => { moving: false, direction: "down", }, - false, positionNotifier, - false, + AvailabilityStatus.ONLINE, {} as UserSocket, [], null, @@ -170,9 +168,8 @@ describe("PositionNotifier", () => { moving: false, direction: "down", }, - false, positionNotifier, - false, + AvailabilityStatus.ONLINE, {} as UserSocket, [], null, diff --git a/docs/maps/camera.md b/docs/maps/camera.md index 9e58fcad..59a212f8 100644 --- a/docs/maps/camera.md +++ b/docs/maps/camera.md @@ -1,15 +1,15 @@ {.section-title.accent.text-primary} # Working with camera -## Focusable Zones +## Focusable Area -It is possible to define special regions on the map that can make the camera zoom and center on themselves. We call them "Focusable Zones". When player gets inside, his camera view will be altered - focused, zoomed and locked on defined zone, like this: +It is possible to define special regions on the map that can make the camera zoom and center on themselves. We call them "Focusable Area". When player gets inside, his camera view will be altered - focused, zoomed and locked on defined area, like this:
-### Adding new **Focusable Zone**: +### Adding new **Focusable Area**: 1. Make sure you are editing an **Object Layer** @@ -29,7 +29,7 @@ It is possible to define special regions on the map that can make the camera zoo -4. Make sure your object is of type "zone"! +4. Make sure your object is of type "area"!
@@ -53,11 +53,11 @@ It is possible to define special regions on the map that can make the camera zoo
-All should be set up now and your new **Focusable Zone** should be working fine! +All should be set up now and your new **Focusable Area** should be working fine! ### Defining custom zoom margin: -If you want, you can add an additional property to control how much should the camera zoom onto focusable zone. +If you want, you can add an additional property to control how much should the camera zoom onto focusable area. 1. Like before, click on **Add Property** @@ -77,7 +77,7 @@ If you want, you can add an additional property to control how much should the c - For example, if you define your zone as a 300x200 rectangle, setting this property to 0.5 *(50%)* means the camera will try to fit within the viewport the entire zone + margin of 50% of its dimensions, so 450x300. + For example, if you define your area as a 300x200 rectangle, setting this property to 0.5 *(50%)* means the camera will try to fit within the viewport the entire area + margin of 50% of its dimensions, so 450x300. - No margin defined diff --git a/docs/maps/images/camera/4_add_zone_type.png b/docs/maps/images/camera/4_add_zone_type.png index 0416d1e4..18224ea5 100644 Binary files a/docs/maps/images/camera/4_add_zone_type.png and b/docs/maps/images/camera/4_add_zone_type.png differ diff --git a/docs/maps/images/camera/5_click_add_property.png b/docs/maps/images/camera/5_click_add_property.png index 9aa96a2f..329ac437 100644 Binary files a/docs/maps/images/camera/5_click_add_property.png and b/docs/maps/images/camera/5_click_add_property.png differ diff --git a/docs/maps/images/camera/7_make_sure_checked.png b/docs/maps/images/camera/7_make_sure_checked.png index 7fbcdb89..6a2d5e34 100644 Binary files a/docs/maps/images/camera/7_make_sure_checked.png and b/docs/maps/images/camera/7_make_sure_checked.png differ diff --git a/docs/maps/meeting-rooms.md b/docs/maps/meeting-rooms.md index 9c3963ed..7753c943 100644 --- a/docs/maps/meeting-rooms.md +++ b/docs/maps/meeting-rooms.md @@ -9,19 +9,24 @@ On your map, you can define special zones (meeting rooms) that will trigger the In order to create Jitsi meet zones: -* You must create a specific layer. -* In layer properties, you MUST add a "`jitsiRoom`" property (of type "`string`"). The value of the property is the name of the room in Jitsi. Note: the name of the room will be "slugified" and prepended with the name of the instance of the map (so that different instances of the map have different rooms) +* You must create a specific object. +* Object must be of type "`area`" +* In object properties, you MUST add a "`jitsiRoom`" property (of type "`string`"). The value of the property is the name of the room in Jitsi. Note: the name of the room will be "slugified" and prepended with a hash of the room URL * You may also use "jitsiWidth" property (of type "number" between 0 and 100) to control the width of the iframe containing the meeting room. -You can have this layer (i.e. your meeting area) to be selectable as the precise location for your meeting using the [Google Calendar integration for Work Adventure](/integrations/google-calendar). To do so, you must set the `meetingRoomLabel` property. You can provide any name that you would like your meeting room to have (as a string). +You can have this object (i.e. your meeting area) to be selectable as the precise location for your meeting using the [Google Calendar integration for Work Adventure](/integrations/google-calendar). To do so, you must set the `meetingRoomLabel` property. You can provide any name that you would like your meeting room to have (as a string). + +{.alert.alert-info} +As an alternative, you may also put the `jitsiRoom` properties on a layer (rather than putting them on an "area" object) +but we advise to stick with "area" objects for better performance! ## Triggering of the "Jitsi meet" action -By default, Jitsi meet will open when a user enters the zone defined on the map. +By default, Jitsi meet will open when a user enters the area defined on the map. It is however possible to trigger Jitsi only on user action. You can do this with the `jitsiTrigger` property. -If you set `jitsiTrigger: onaction`, when the user walks on the layer, an alert message will be displayed at the bottom of the screen: +If you set `jitsiTrigger: onaction`, when the user walks on the area, an alert message will be displayed at the bottom of the screen:
@@ -32,7 +37,7 @@ If you set `jitsiTriggerMessage: your message action` you can edit alert message ## Customizing your "Jitsi meet" -Your Jitsi meet experience can be customized using Jitsi specific config options. The `jitsiConfig` and `jitsiInterfaceConfig` properties can be used on the Jitsi layer to change the way Jitsi looks and behaves. Those 2 properties are accepting a JSON string. +Your Jitsi meet experience can be customized using Jitsi specific config options. The `jitsiConfig` and `jitsiInterfaceConfig` properties can be used on the Jitsi object to change the way Jitsi looks and behaves. Those 2 properties are accepting a JSON string. For instance, use `jitsiConfig: { "startWithAudioMuted": true }` to automatically mute the microphone when someone enters a room. Or use `jitsiInterfaceConfig: { "DEFAULT_BACKGROUND": "#77ee77" }` to change the background color of Jitsi. @@ -60,7 +65,7 @@ You can grant moderator rights to some of your members. Jitsi moderators can: * Mute everybody expect one speaker * Kick users out of the meeting -In order to grant moderator rights to a given user, you can add a `jitsiRoomAdminTag` property to your Jitsi layer. For instance, if you write a property: +In order to grant moderator rights to a given user, you can add a `jitsiRoomAdminTag` property to your Jitsi object. For instance, if you write a property: jitsiRoomAdminTag: speaker @@ -74,7 +79,7 @@ WorkAdventure usually comes with a default Jitsi meet installation. If you are u You have the possibility, in your map, to override the Jitsi meet instance that will be used by default. This can be useful for regulatory reasons. Maybe your company wants to keep control on the video streams and therefore, wants to self-host a Jitsi instance? Or maybe you want to use a very special configuration or very special version of Jitsi? -Use the `jitsiUrl` property to in the Jitsi layer to specify the Jitsi instance that should be used. Beware, `jitsiUrl` takes in parameter a **domain name**, without the protocol. So you should use: +Use the `jitsiUrl` property to in the Jitsi object to specify the Jitsi instance that should be used. Beware, `jitsiUrl` takes in parameter a **domain name**, without the protocol. So you should use: `jitsiUrl: meet.jit.si` and not `jitsiUrl: https://meet.jit.si` @@ -82,3 +87,15 @@ and not {.alert.alert-info} When you use `jitsiUrl`, the targeted Jitsi instance must be public. You cannot use moderation features or the JWT tokens authentication with maps configured using the `jitsiUrl` property. + +## Full control over the Jitsi room name + +By default, the name of the room will be "slugified" and prepended with a hash of the room URL. +This is what you want most of the time. Indeed, different maps with the same Jitsi room name (the same `jitsiRoom` property) will not share the same Jitsi room instance. + +However, sometimes, you may actually want to have different WorkAdventure meeting rooms that are actually sharing +the same Jitsi meet meeting room. Or if you are pointing to a custom Jitsi server (using the `jitsiUrl` property), +you may want to point to a specific existing room. + +For all those use cases, you can use `jitsiNoPrefix: true`. This will remove the automatic prefixing +of the hash and will give you full control on the Jitsi room name. diff --git a/docs/maps/opening-a-website.md b/docs/maps/opening-a-website.md index a84bde30..52a68168 100644 --- a/docs/maps/opening-a-website.md +++ b/docs/maps/opening-a-website.md @@ -10,8 +10,9 @@ on the right side of the screen) In order to create a zone that opens websites: -* You must create a specific layer. -* In layer properties, you MUST add a "`openWebsite`" property (of type "`string`"). The value of the property is the URL of the website to open (the URL must start with "https://") +* You must create a specific object. +* Object must be of type "`area`" +* In object properties, you MUST add a "`openWebsite`" property (of type "`string`"). The value of the property is the URL of the website to open (the URL must start with "https://") * You may also use "`openWebsiteWidth`" property (of type "`int`" or "`float`" between 0 and 100) to control the width of the iframe. * You may also use "`openTab`" property (of type "`string`") to open in a new tab instead. @@ -19,6 +20,10 @@ In order to create a zone that opens websites: A website can explicitly forbid another website from loading it in an iFrame using the [X-Frame-Options HTTP header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options). +{.alert.alert-info} +As an alternative, you may also put the `openWebsite` properties on a layer (rather than putting them on an "area" object) +but we advise to stick with "area" objects for better performance! + ## Integrating a Youtube video A common use case is to use `openWebsite` to open a Youtube video. @@ -43,7 +48,7 @@ By default, the iFrame will open when a user enters the zone defined on the map. It is however possible to trigger the iFrame only on user action. You can do this with the `openWebsiteTrigger` property. -If you set `openWebsiteTrigger: onaction`, when the user walks on the layer, an alert message will be displayed at the bottom of the screen: +If you set `openWebsiteTrigger: onaction`, when the user walks on the area, an alert message will be displayed at the bottom of the screen:
@@ -52,7 +57,7 @@ If you set `openWebsiteTrigger: onaction`, when the user walks on the layer, an If you set `openWebsiteTriggerMessage: your message action` you can edit alert message displayed. If is not defined, the default message displayed is 'Press on SPACE to open the web site'. -If you set `openWebsiteTrigger: onicon`, when the user walks on the layer, an icon will be displayed at the bottom of the screen: +If you set `openWebsiteTrigger: onicon`, when the user walks on the area, an icon will be displayed at the bottom of the screen:
@@ -78,6 +83,6 @@ Cowebsites allow you to have several sites open at the same time. If you want to open a Jitsi and another page it's easy! -You have just to [add a Jitsi to the map](meeting-rooms.md) and [add a co-website](opening-a-website.md#the-openwebsite-property) on the same layer. +You have just to [add a Jitsi to the map](meeting-rooms.md) and [add a co-website](opening-a-website.md#the-openwebsite-property) on the same object. It's done! diff --git a/docs/maps/special-zones.md b/docs/maps/special-zones.md index 30ebebab..1d22a3fc 100644 --- a/docs/maps/special-zones.md +++ b/docs/maps/special-zones.md @@ -9,8 +9,13 @@ On your map, you can define special silent zones where nobody is allowed to talk In order to create a silent zone: -* You must create a specific layer. -* In layer properties, you MUST add a boolean "`silent`" property. If the silent property is checked, the users are entering the silent zone when they walk on any tile of the layer. +* You must create a specific object. +* Object must be of type "`area`" +* In object properties, you MUST add a boolean "`silent`" property. If the silent property is checked, the users are entering the silent zone when they walk on the area. + +{.alert.alert-info} +As an alternative, you may also put the `silent` property on a layer (rather than putting them on an "area" object) +but we advise to stick with "area" objects for better performance! ## Playing sounds or background music @@ -18,10 +23,15 @@ Your map can define special zones where a sound or background music will automat In order to create a zone that triggers sounds/music: -* You must create a specific layer. -* In layer properties, you MUST add a "`playAudio`" property. The value of the property is a URL to an MP3 file that will be played. The URL can be relative to the URL of the map. +* You must create a specific object. +* Object must be of type "`area`" +* In object properties, you MUST add a "`playAudio`" property. The value of the property is a URL to an MP3 file that will be played. The URL can be relative to the URL of the map. * You may use the boolean property "`audioLoop`" to make the sound loop (thanks captain obvious). * If the "`audioVolume`" property is set, the audio player uses either the value of the property or the last volume set by the user - whichever is smaller. This property is a float from 0 to 1.0 {.alert.alert-info} "`playAudioLoop`" is deprecated and should not be used anymore. + +{.alert.alert-info} +As an alternative, you may also put the `playAudio` properties on a layer (rather than putting them on an "area" object) +but we advise to stick with "area" objects for better performance! diff --git a/docs/maps/wa-maps.md b/docs/maps/wa-maps.md index 6e84a251..8bec629b 100644 --- a/docs/maps/wa-maps.md +++ b/docs/maps/wa-maps.md @@ -87,11 +87,11 @@ Repeat for every tile that should be "collidable". In the next sections, you will see how you can add behaviour on your map by adding "properties". You can add properties for a variety of features: putting exits, opening websites, meeting rooms, silent zones, etc... -You can add properties either on individual tiles of a tileset OR on a complete layer. +You can add properties either on individual tiles of a tileset, on Tiled object OR on a complete layer. -If you put a property on a layer, it will be triggered if your Woka walks on any tile of the layer. +If you put a property on a object or layer, it will be triggered if your Woka walks on object area / any tile of the layer. -The exception is the "collides" property that can only be set on tiles, but not on a complete layer. +The exception is the "collides" property that can only be set on tiles, but not on an object or on complete layer. ## Insert helpful information in your map diff --git a/front/public/resources/icons/icon_status_indicator_inside.png b/front/public/resources/icons/icon_status_indicator_inside.png new file mode 100644 index 00000000..29a2daad Binary files /dev/null and b/front/public/resources/icons/icon_status_indicator_inside.png differ diff --git a/front/public/resources/icons/icon_status_indicator_outline.png b/front/public/resources/icons/icon_status_indicator_outline.png new file mode 100644 index 00000000..67f86ec5 Binary files /dev/null and b/front/public/resources/icons/icon_status_indicator_outline.png differ diff --git a/front/src/Administration/AnalyticsClient.ts b/front/src/Administration/AnalyticsClient.ts index 4c1ca93a..8c14eaed 100644 --- a/front/src/Administration/AnalyticsClient.ts +++ b/front/src/Administration/AnalyticsClient.ts @@ -9,7 +9,7 @@ class AnalyticsClient { constructor() { if (POSTHOG_API_KEY && POSTHOG_URL) { this.posthogPromise = import("posthog-js").then(({ default: posthog }) => { - posthog.init(POSTHOG_API_KEY, { api_host: POSTHOG_URL, disable_cookie: true }); + posthog.init(POSTHOG_API_KEY, { api_host: POSTHOG_URL }); //the posthog toolbar need a reference in window to be able to work window.posthog = posthog; return posthog; diff --git a/front/src/Api/Events/ChangeZoneEvent.ts b/front/src/Api/Events/ChangeAreaEvent.ts similarity index 74% rename from front/src/Api/Events/ChangeZoneEvent.ts rename to front/src/Api/Events/ChangeAreaEvent.ts index c5ed1a4c..38764ad3 100644 --- a/front/src/Api/Events/ChangeZoneEvent.ts +++ b/front/src/Api/Events/ChangeAreaEvent.ts @@ -7,4 +7,4 @@ export const isChangeZoneEvent = z.object({ /** * A message sent from the game to the iFrame when a user enters or leaves a zone. */ -export type ChangeZoneEvent = z.infer; +export type ChangeAreaEvent = z.infer; diff --git a/front/src/Api/Events/IframeEvent.ts b/front/src/Api/Events/IframeEvent.ts index 16f51a6c..36e28948 100644 --- a/front/src/Api/Events/IframeEvent.ts +++ b/front/src/Api/Events/IframeEvent.ts @@ -29,7 +29,7 @@ import { isMenuRegisterEvent, isUnregisterMenuEvent } from "./ui/MenuRegisterEve import type { ChangeLayerEvent } from "./ChangeLayerEvent"; import { isPlayerPosition } from "./PlayerPosition"; import type { WasCameraUpdatedEvent } from "./WasCameraUpdatedEvent"; -import type { ChangeZoneEvent } from "./ChangeZoneEvent"; +import type { ChangeAreaEvent } from "./ChangeAreaEvent"; import { isCameraSetEvent } from "./CameraSetEvent"; import { isCameraFollowPlayerEvent } from "./CameraFollowPlayerEvent"; import { isColorEvent } from "./ColorEvent"; @@ -163,8 +163,8 @@ export interface IframeResponseEventMap { leaveEvent: EnterLeaveEvent; enterLayerEvent: ChangeLayerEvent; leaveLayerEvent: ChangeLayerEvent; - enterZoneEvent: ChangeZoneEvent; - leaveZoneEvent: ChangeZoneEvent; + enterAreaEvent: ChangeAreaEvent; + leaveAreaEvent: ChangeAreaEvent; buttonClickedEvent: ButtonClickedEvent; remotePlayerClickedEvent: RemotePlayerClickedEvent; actionsMenuActionClickedEvent: ActionsMenuActionClickedEvent; diff --git a/front/src/Api/IframeListener.ts b/front/src/Api/IframeListener.ts index 63e9e7c0..0d32f5ff 100644 --- a/front/src/Api/IframeListener.ts +++ b/front/src/Api/IframeListener.ts @@ -28,7 +28,7 @@ import { ModifyEmbeddedWebsiteEvent } from "./Events/EmbeddedWebsiteEvent"; import { handleMenuRegistrationEvent, handleMenuUnregisterEvent } from "../Stores/MenuStore"; import type { ChangeLayerEvent } from "./Events/ChangeLayerEvent"; import type { WasCameraUpdatedEvent } from "./Events/WasCameraUpdatedEvent"; -import type { ChangeZoneEvent } from "./Events/ChangeZoneEvent"; +import type { ChangeAreaEvent } from "./Events/ChangeAreaEvent"; import { CameraSetEvent } from "./Events/CameraSetEvent"; import { CameraFollowPlayerEvent } from "./Events/CameraFollowPlayerEvent"; import type { RemotePlayerClickedEvent } from "./Events/RemotePlayerClickedEvent"; @@ -450,21 +450,21 @@ class IframeListener { }); } - sendEnterZoneEvent(zoneName: string) { + sendEnterAreaEvent(areaName: string) { this.postMessage({ - type: "enterZoneEvent", + type: "enterAreaEvent", data: { - name: zoneName, - } as ChangeZoneEvent, + name: areaName, + } as ChangeAreaEvent, }); } - sendLeaveZoneEvent(zoneName: string) { + sendLeaveAreaEvent(areaName: string) { this.postMessage({ - type: "leaveZoneEvent", + type: "leaveAreaEvent", data: { - name: zoneName, - } as ChangeZoneEvent, + name: areaName, + } as ChangeAreaEvent, }); } diff --git a/front/src/Api/desktop/index.ts b/front/src/Api/desktop/index.ts index 0b1ea9f9..6e38403c 100644 --- a/front/src/Api/desktop/index.ts +++ b/front/src/Api/desktop/index.ts @@ -1,4 +1,4 @@ -import { isSilentStore, requestedCameraState, requestedMicrophoneState } from "../../Stores/MediaStore"; +import { requestedCameraState, requestedMicrophoneState, silentStore } from "../../Stores/MediaStore"; import { get } from "svelte/store"; import { WorkAdventureDesktopApi } from "@wa-preload-app"; @@ -36,8 +36,8 @@ class DesktopApi { } }); - isSilentStore.subscribe((value) => { - this.isSilent = value; + silentStore.subscribe((silent) => { + this.isSilent = silent; }); } } diff --git a/front/src/Components/CameraControls.svelte b/front/src/Components/CameraControls.svelte index 1a2caf93..623be040 100644 --- a/front/src/Components/CameraControls.svelte +++ b/front/src/Components/CameraControls.svelte @@ -1,6 +1,6 @@
@@ -94,7 +87,7 @@
@@ -103,7 +96,7 @@
@@ -113,26 +106,26 @@
- {#if $requestedScreenSharingState && !isSilent} + {#if $requestedScreenSharingState && !$silentStore} Start screen sharing {:else} Stop screen sharing {/if}
-
- {#if $requestedCameraState && !isSilent} +
+ {#if $requestedCameraState && !$silentStore} Turn on webcam {:else} Turn off webcam {/if}
-
- {#if $requestedMicrophoneState && !isSilent} +
+ {#if $requestedMicrophoneState && !$silentStore} Turn on microphone {:else} Turn off microphone diff --git a/front/src/Components/Menu/GuestSubMenu.svelte b/front/src/Components/Menu/GuestSubMenu.svelte index fbbc48a4..3afdfb51 100644 --- a/front/src/Components/Menu/GuestSubMenu.svelte +++ b/front/src/Components/Menu/GuestSubMenu.svelte @@ -47,7 +47,13 @@ {#if !canShare} {:else} diff --git a/front/src/Components/Menu/Menu.svelte b/front/src/Components/Menu/Menu.svelte index 94e94850..97def3cf 100644 --- a/front/src/Components/Menu/Menu.svelte +++ b/front/src/Components/Menu/Menu.svelte @@ -4,7 +4,6 @@ import ProfileSubMenu from "./ProfileSubMenu.svelte"; import WorldsSubMenu from "./WorldsSubMenu.svelte"; import AboutRoomSubMenu from "./AboutRoomSubMenu.svelte"; - import GlobalMessageSubMenu from "./GlobalMessagesSubMenu.svelte"; import ContactSubMenu from "./ContactSubMenu.svelte"; import CustomSubMenu from "./CustomSubMenu.svelte"; import GuestSubMenu from "./GuestSubMenu.svelte"; @@ -26,16 +25,16 @@ let props: { url: string; allowApi: boolean }; let unsubscriberSubMenuStore: Unsubscriber; - onMount(() => { + onMount(async () => { unsubscriberSubMenuStore = subMenusStore.subscribe(() => { if (!$subMenusStore.includes(activeSubMenu)) { - switchMenu($subMenusStore[0]); + void switchMenu($subMenusStore[0]); } }); checkSubMenuToShow(); - switchMenu($subMenusStore[0]); + await switchMenu($subMenusStore[0]); }); onDestroy(() => { @@ -44,7 +43,7 @@ } }); - function switchMenu(menu: MenuItem) { + async function switchMenu(menu: MenuItem) { if (menu.type === "translated") { activeSubMenu = menu; switch (menu.key) { @@ -64,7 +63,7 @@ activeComponent = AboutRoomSubMenu; break; case SubMenusInterface.globalMessages: - activeComponent = GlobalMessageSubMenu; + activeComponent = (await import("./GlobalMessagesSubMenu.svelte")).default; break; case SubMenusInterface.contact: activeComponent = ContactSubMenu; @@ -115,7 +114,7 @@ diff --git a/front/src/Components/Menu/ProfileSubMenu.svelte b/front/src/Components/Menu/ProfileSubMenu.svelte index 74296825..e5d7dbb5 100644 --- a/front/src/Components/Menu/ProfileSubMenu.svelte +++ b/front/src/Components/Menu/ProfileSubMenu.svelte @@ -1,14 +1,19 @@
- {#if isSilent} + {#if $silentStore}
{$LL.camera.my.silentZone()}
{:else if $localStreamStore.type === "success" && $localStreamStore.stream}