diff --git a/package.json b/package.json index dc3de716..78912e9d 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,7 @@ "@types/fs-extra": "^11.0.4", "@types/gh-pages": "^6.1.0", "@types/ini": "^4.1.0", - "@types/node": "^18.0.6", + "@types/node": "^18.19.50", "@types/object-assign": "^4.0.30", "@types/react": "^18.2.67", "@types/react-dom": "^18.0.2", diff --git a/src/activitys/MainActivity.tsx b/src/activitys/MainActivity.tsx index f7dcbb43..bfb2eea3 100644 --- a/src/activitys/MainActivity.tsx +++ b/src/activitys/MainActivity.tsx @@ -30,6 +30,7 @@ import { LogcatActivity } from "./LogcatActivity"; import UnverifiedHostActivity from "./UnverifiedHostActivity"; import { LandingActivity } from "./LandingActivity"; import { ModulesQueue } from "@Components/ModulesQueue"; +import { useConfirm } from "material-ui-confirm"; const getLocation = () => { if (window.location !== window.parent.location) { @@ -71,6 +72,7 @@ const MainActivity = (): JSX.Element => { const { theme } = useTheme(); const { modFS } = useModFS(); const InitialActivity = useCheckRoot(); + const confirm = useConfirm(); const [isSplitterOpen, setIsSplitterOpen] = useState(false); @@ -108,7 +110,6 @@ const MainActivity = (): JSX.Element => { splitter: { show: () => showSplitter(), hide: () => hideSplitter(), - state: isSplitterOpen, }, }; @@ -313,6 +314,26 @@ const MainActivity = (): JSX.Element => { return ( { + if (isSplitterOpen) { + hideSplitter(); + } else { + confirm({ + title: strings("exit_app"), + description: strings("exit_app_desc"), + confirmationText: strings("yes"), + cancellationText: strings("no"), + }) + .then(() => { + if (typeof e.callParentHandler === "function") { + e.callParentHandler(); + } else { + navigator.app.exitApp(); + } + }) + .catch(() => {}); + } + }} onInit={() => { const mmrlFolder = new SuFile(modFS("MMRLFOL")); diff --git a/src/activitys/MainApplication.tsx b/src/activitys/MainApplication.tsx index c42bb99d..0ff6c1b1 100644 --- a/src/activitys/MainApplication.tsx +++ b/src/activitys/MainApplication.tsx @@ -45,20 +45,9 @@ const MainApplication = () => { const handleBackEvent = React.useCallback( (e: any) => { if (index === 0) { - confirm({ - title: strings("exit_app"), - description: strings("exit_app_desc"), - confirmationText: strings("yes"), - cancellationText: strings("no"), - }) - .then(() => { - if (typeof e.callParentHandler === "function") { - e.callParentHandler(); - } else { - navigator.app.exitApp(); - } - }) - .catch(() => {}); + if (typeof e.callParentHandler === "function") { + e.callParentHandler(); + } } else { setIndex(0); } diff --git a/src/components/module/DeviceModule.tsx b/src/components/module/DeviceModule.tsx index a2992420..cb59856a 100644 --- a/src/components/module/DeviceModule.tsx +++ b/src/components/module/DeviceModule.tsx @@ -208,12 +208,12 @@ const DeviceModule = React.memo((props) => { if (remove.exist()) { if (remove.delete()) { setIsSwitchDisabled(false); - log.d(`${module} has been recovered`); + log.d(`${id} has been recovered`); } else { - log.e(`Failed to restore ${module}`); + log.e(`Failed to restore ${id}`); } } else { - log.e(`This remove file don't exists for ${module}`); + log.e(`This remove file don't exists for ${id}`); } }} disableElevation diff --git a/src/hooks/useActivity.ts b/src/hooks/useActivity.ts index 47d1b8b5..d7836a2a 100644 --- a/src/hooks/useActivity.ts +++ b/src/hooks/useActivity.ts @@ -22,7 +22,6 @@ export interface ActivityContext { readonly splitter: { readonly show: () => void; readonly hide: () => void; - readonly state: boolean; }; }