cookie and pwa stuff
This commit is contained in:
15
src/hooks/use-is-pwa.ts
Normal file
15
src/hooks/use-is-pwa.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
export function useIsPWA(): boolean {
|
||||
const [isPWA, setIsPWA] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
const isStandalone = window.matchMedia('(display-mode: standalone)').matches
|
||||
|
||||
const isIOSStandalone = 'standalone' in window.navigator && (window.navigator as any).standalone
|
||||
|
||||
setIsPWA(isStandalone || isIOSStandalone)
|
||||
}, [])
|
||||
|
||||
return isPWA
|
||||
}
|
||||
Reference in New Issue
Block a user