(frontend) add sound notification for unread messages

Add togglable audio alerts when new chat messages arrive,
allowing users to customize their notification preferences.
This commit is contained in:
lebaudantoine
2025-02-12 10:38:43 +01:00
committed by aleb_the_flash
parent a979f05549
commit 19804d2e3f
2 changed files with 3 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ export const MainNotificationToast = () => {
participant?: Participant | undefined participant?: Participant | undefined
) => { ) => {
if (!participant || participant.isLocal) return if (!participant || participant.isLocal) return
triggerNotificationSound(NotificationType.MessageReceived)
toastQueue.add( toastQueue.add(
{ {
participant: participant, participant: participant,
@@ -43,7 +44,7 @@ export const MainNotificationToast = () => {
return () => { return () => {
room.off(RoomEvent.ChatMessage, handleChatMessage) room.off(RoomEvent.ChatMessage, handleChatMessage)
} }
}, [room]) }, [room, triggerNotificationSound])
useEffect(() => { useEffect(() => {
const handleDataReceived = ( const handleDataReceived = (

View File

@@ -14,6 +14,7 @@ const DEFAULT_STATE: State = {
new Map([ new Map([
[NotificationType.ParticipantJoined, true], [NotificationType.ParticipantJoined, true],
[NotificationType.HandRaised, true], [NotificationType.HandRaised, true],
[NotificationType.MessageReceived, true],
]) ])
), ),
soundNotificationVolume: 0.1, soundNotificationVolume: 0.1,