🚸(frontend) disable toast notifications on mobile
Due to responsiveness issues and awkward display on mobile screens. Note: Chrome inspector's responsive mode inaccurately triggers mobile behavior. It uses a temporary function imported from LiveKit.
This commit is contained in:
committed by
aleb_the_flash
parent
6324608a4a
commit
7edf7d194b
@@ -4,12 +4,15 @@ import { Participant, RemoteParticipant, RoomEvent } from 'livekit-client'
|
|||||||
import { ToastProvider, toastQueue } from './components/ToastProvider'
|
import { ToastProvider, toastQueue } from './components/ToastProvider'
|
||||||
import { NotificationType } from './NotificationType'
|
import { NotificationType } from './NotificationType'
|
||||||
import { Div } from '@/primitives'
|
import { Div } from '@/primitives'
|
||||||
|
import { isMobileBrowser } from '@livekit/components-core/src/helper/detectMobileBrowser.ts'
|
||||||
|
|
||||||
export const MainNotificationToast = () => {
|
export const MainNotificationToast = () => {
|
||||||
const room = useRoomContext()
|
const room = useRoomContext()
|
||||||
// fixme - don't show toast on mobile screen
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const showJoinNotification = (participant: Participant) => {
|
const showJoinNotification = (participant: Participant) => {
|
||||||
|
if (isMobileBrowser()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
toastQueue.add(
|
toastQueue.add(
|
||||||
{
|
{
|
||||||
participant,
|
participant,
|
||||||
@@ -54,6 +57,9 @@ export const MainNotificationToast = () => {
|
|||||||
if (!participant) {
|
if (!participant) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (isMobileBrowser()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const notification = decoder.decode(payload)
|
const notification = decoder.decode(payload)
|
||||||
const existingToast = toastQueue.visibleToasts.find(
|
const existingToast = toastQueue.visibleToasts.find(
|
||||||
(toast) =>
|
(toast) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user