import { useEffect , useState } from "react" ; export const useIsAlreadyPWA = ( ) : boolean => { const [ isAlreadyPWA , setIsAlreadyPWA ] = useState ( true ) ; useEffect ( ( ) => { setIsAlreadyPWA ( window . matchMedia ( "(display-mode: standalone)" ) . matches || window . navigator . standalone || document . referrer . includes ( "android-app://" ) ) ; } , [ ] ) ; return isAlreadyPWA ; } ;