import {useEffect, useRef, useState} from "react"; import {useThemeProvider} from "@contexts/themeContext"; import MuiDrawer from "@mui/material/Drawer"; import styles from "./styles.module.scss"; import { isInAppBrowser, openProgressierInstall, openUrlUseChrome } from "@utils/UAUtils"; import Fade from "@mui/material/Fade"; import Grow from "@mui/material/Grow"; import Modal from "@mui/material/Modal"; const i18n=global.i18n; const WInstallBox = () => { const {isMobile} = useThemeProvider(); const [isShow, setIsShow] = useState(false); const installRef = useRef(null); const [iconUrl, setIconUrl] = useState(""); const show=()=>{ setIsShow(true); } const hide=()=>{ setIsShow(false); } const onInstall=()=>{ if (isInAppBrowser()){ openUrlUseChrome(); } else { openProgressierInstall(); setIsShow(false); } } const onCancel=()=>{ setIsShow(false); } useEffect(()=>{ const installBox={ show, hide }; global.installBox=installBox; if (window.progressier!=null){ if (window.progressier.data!=null){ let params=window.progressier.data.params; if (params!=null){ setIconUrl(params.icon180); } } } },[]) const renderInstall=()=>{ return (
{i18n.t("installBox.tips")}
) } const renderMobile = () => { return ( { // setIsShow(false) }}> {renderInstall()} ) } const renderDesktop = () => { return ( { }} closeAfterTransition>
{renderInstall()}
) } return ( <> {isMobile()?renderMobile():renderDesktop()} ) } export default WInstallBox;