diff --git a/frontend/src/component/bottomsheet/BottomSheet.tsx b/frontend/src/component/bottomsheet/BottomSheet.tsx index 31d25c0..00c901c 100644 --- a/frontend/src/component/bottomsheet/BottomSheet.tsx +++ b/frontend/src/component/bottomsheet/BottomSheet.tsx @@ -88,7 +88,7 @@ export const BottomSheet = ({ return ( <>
Promise<'granted' | 'denied'>; } diff --git a/frontend/src/pages/GuestView.tsx b/frontend/src/pages/GuestView.tsx index 3a568bd..eea0b45 100644 --- a/frontend/src/pages/GuestView.tsx +++ b/frontend/src/pages/GuestView.tsx @@ -7,7 +7,7 @@ import { IPoint } from '@/lib/types/canvasInterface.ts'; import { guestEntity } from '@/api/dto/channel.dto.ts'; import { GuestMarker } from '@/component/IconGuide/GuestMarker.tsx'; import { LoadingSpinner } from '@/component/common/loadingSpinner/LoadingSpinner.tsx'; -import { getUserLocation } from '@/hooks/getUserLocation.ts'; +import { getUserLocation, IDeviceOrientationEventWithPermission } from '@/hooks/getUserLocation.ts'; import { loadLocalData, saveLocalData } from '@/utils/common/manageLocalData.ts'; import { AppConfig } from '@/lib/constants/commonConstants.ts'; import { v4 as uuidv4 } from 'uuid'; @@ -31,6 +31,33 @@ export const GuestView = () => { const wsRef = useRef(null); + useEffect(() => { + const requestOrientationPermission = async () => { + const DeviceOrientationEventTyped = + DeviceOrientationEvent as unknown as IDeviceOrientationEventWithPermission; + + if ( + typeof DeviceOrientationEventTyped !== 'undefined' && + typeof DeviceOrientationEventTyped.requestPermission === 'function' + ) { + try { + const permission = await DeviceOrientationEventTyped.requestPermission(); + if (permission === 'granted') { + console.log('Device Orientation permission granted.'); + } else { + console.error('Device Orientation permission denied.'); + } + } catch { + console.error('Failed to request Device Orientation permission:'); + } + } else { + console.warn('DeviceOrientationEvent.requestPermission is not supported on this browser.'); + } + }; + + requestOrientationPermission(); + }, []); + useEffect(() => { // 소켓 연결 초기화 const token = loadLocalData(AppConfig.KEYS.BROWSER_TOKEN) || uuidv4();