✨(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:
committed by
aleb_the_flash
parent
a979f05549
commit
19804d2e3f
@@ -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 = (
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user