()
| 68 | } |
| 69 | |
| 70 | export function usePlatform(): Platform { |
| 71 | const isTelegram = useMemo(() => isTelegramApp(), []) |
| 72 | const isTouch = useMemo( |
| 73 | () => typeof window !== 'undefined' && window.matchMedia('(pointer: coarse)').matches, |
| 74 | [] |
| 75 | ) |
| 76 | |
| 77 | return { |
| 78 | isTelegram, |
| 79 | isTouch, |
| 80 | haptic |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | // Non-hook version for use outside React components |
| 85 | export function getPlatform(): Platform { |
no test coverage detected