Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed Sep 18, 2024
1 parent 0a3f91b commit 6a5bc33
Show file tree
Hide file tree
Showing 25 changed files with 267 additions and 174 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"react-onsenui": "^1.13.2",
"react-render-tools": "^1.0.1",
"react-syntax-highlighter": "^15.5.0",
"react-transition-group": "^4.4.5",
"react-zoom-pan-pinch": "^3.3.0",
"reflect-metadata": "^0.2.2",
"underscore": "^1.13.6",
Expand Down
4 changes: 2 additions & 2 deletions src/activitys/LicensesActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useFetch } from "@Hooks/useFetch";
import { useTheme } from "@Hooks/useTheme";
import { os } from "@Native/Os";
import li from "@Util/licenses.json";
import FetchTextActivity from "./FetchTextActivity";
import { Activities } from ".";

const DepCard = (props: { dep: (typeof li)[0] }) => {
const { theme } = useTheme();
Expand All @@ -34,7 +34,7 @@ const DepCard = (props: { dep: (typeof li)[0] }) => {
const handleOpenLicense = () => {
if (licenseData) {
context.pushPage({
component: FetchTextActivity,
component: Activities.FetchText,
key: "license_" + dep.license,
extra: {
raw_data: licenseData.licenseText,
Expand Down
2 changes: 1 addition & 1 deletion src/activitys/LogcatActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ const LogcatActivity = () => {
);
};

export { LogcatActivity };
export default LogcatActivity;
63 changes: 54 additions & 9 deletions src/activitys/MainActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { os } from "@Native/Os";
import { Shell } from "@Native/Shell";
import { RouterUtil } from "@Util/RouterUtil";
import eruda from "eruda";
import React, { useState } from "react";
import React, { Suspense, useState } from "react";
import { IntentPusher } from "../hooks/useActivity";
import { DrawerFragment } from "./fragments/DrawerFragment";
import MainApplication from "./MainApplication";
Expand All @@ -26,11 +26,12 @@ import { useModFS } from "@Hooks/useModFS";
import { useStrings } from "@Hooks/useStrings";
import { SuFile } from "@Native/SuFile";
import pkg from "@Package";
import { LogcatActivity } from "./LogcatActivity";
import UnverifiedHostActivity from "./UnverifiedHostActivity";
import { LandingActivity } from "./LandingActivity";
import { ModulesQueue } from "@Components/ModulesQueue";
import { useConfirm } from "material-ui-confirm";
import { ProgressCircular } from "react-onsenui";
import { Activities } from ".";

const getLocation = () => {
if (window.location !== window.parent.location) {
Expand Down Expand Up @@ -139,9 +140,12 @@ const MainActivity = (): JSX.Element => {
options: {
...options,
animationOptions: {
duration: 0.2,
timing: "ease-in",
animation: "fade-md",
// duration: 0.2,
duration: 0,
// timing: "ease-in",
timing: "none",
// animation: "fade-md",
animation: "none",
},
},
} as any)
Expand All @@ -156,7 +160,16 @@ const MainActivity = (): JSX.Element => {
},
};

const options = {};
const options = {
animationOptions: {
// duration: 0.2,
duration: 0,
// timing: "ease-in",
timing: "none",
// animation: "fade-md",
animation: "none",
},
};

setRouteConfig((prev: any) =>
RouterUtil.push({
Expand Down Expand Up @@ -202,10 +215,42 @@ const MainActivity = (): JSX.Element => {
setRouteConfig((prev: any) => RouterUtil.postPop(prev));
};

const fallbackSuspense = React.useMemo(
() => (
<Page
modifier="fade"
renderToolbar={() => {
return (
<Toolbar modifier="noshadow">
<Toolbar.Left>
<Toolbar.BackButton onClick={popPage} />
</Toolbar.Left>
<Toolbar.Center>Loading...</Toolbar.Center>
</Toolbar>
);
}}
>
<ProgressCircular
indeterminate
style={{
position: "absolute",
left: "50%",
top: "50%",
WebkitTransform: "translate(-50%, -50%)",
transform: "translate(-50%, -50%)",
}}
/>
</Page>
),
[]
);

const renderPage = (route: any, props: any) => {
return (
<ErrorBoundary fallback={fallback}>
<route.component {...props} />
<Suspense fallback={fallbackSuspense}>
<route.component {...props} />
</Suspense>
</ErrorBoundary>
);
};
Expand Down Expand Up @@ -261,14 +306,14 @@ const MainActivity = (): JSX.Element => {

const handleOpenSettings = () => {
pushPage({
component: SettingsActivity,
component: Activities.Settings,
key: "SettingsActivity",
});
};

const handleOpenLogcat = () => {
pushPage({
component: LogcatActivity,
component: Activities.Logcat,
key: "LogcatActivity",
});
};
Expand Down
11 changes: 5 additions & 6 deletions src/activitys/MainApplication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useSettings } from "@Hooks/useSettings";
import { useStrings } from "@Hooks/useStrings";
import CodeRoundedIcon from "@mui/icons-material/CodeRounded";
import CreateNewFolderIcon from "@mui/icons-material/CreateNewFolder";
import LayersIcon from "@mui/icons-material/Layers";
import MenuIcon from "@mui/icons-material/Menu";
import VolunteerActivismIcon from "@mui/icons-material/VolunteerActivism";
import Typography from "@mui/material/Typography";
Expand All @@ -25,10 +26,8 @@ import { SuZip } from "@Native/SuZip";
import { useConfirm } from "material-ui-confirm";
import { Properties } from "properties-file";
import React from "react";
import { Activities } from ".";
import ModuleFragment from "./fragments/ModuleFragment";
import InstallTerminalV2Activity from "./InstallTerminalV2Activity";
import { ModuleViewActivity } from "./ModuleViewActivity";
import LayersIcon from "@mui/icons-material/Layers";

const TAG = "MainApplication";

Expand Down Expand Up @@ -75,7 +74,7 @@ const MainApplication = () => {
})
.then(() => {
context.pushPage({
component: InstallTerminalV2Activity,
component: Activities.InstallTerminal,
key: "InstallTerminalV2Activity",
extra: {
exploreInstall: false,
Expand All @@ -96,7 +95,7 @@ const MainApplication = () => {
const m_ = modules.find((m) => m.id === id);
if (m_) {
context.pushPage({
component: ModuleViewActivity,
component: Activities.ModuleView,
key: "ModuleViewActivity",
extra: m_,
});
Expand Down Expand Up @@ -159,7 +158,7 @@ const MainApplication = () => {
chooseModule.onChose = (files) => {
if (Chooser.isSuccess(files)) {
context.pushPage({
component: InstallTerminalV2Activity,
component: Activities.InstallTerminal,
key: "InstallTerminalV2Activity",
extra: {
exploreInstall: false,
Expand Down
4 changes: 3 additions & 1 deletion src/activitys/ModConfActivity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ const ModConfActivity = () => {
);
};

export { ModConfActivity, ModConfActivityExtra };
export default ModConfActivity;

export { ModConfActivityExtra };
7 changes: 3 additions & 4 deletions src/activitys/ModConfStandaloneActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { useActivity } from "@Hooks/useActivity";
import { useModFS } from "@Hooks/useModFS";
import { List, ListItem, ListItemButton, ListItemText } from "@mui/material";
import { SuFile } from "@Native/SuFile";
import { SuZip } from "@Native/SuZip";
import { path } from "@Util/path";
import { ModConfActivity, ModConfActivityExtra } from "./ModConfActivity";
import ModFS from "modfs";
import { Activities } from ".";
import { ModConfActivityExtra } from "./ModConfActivity";

const ModConfStandaloneActivity = () => {
const { context } = useActivity();
Expand Down Expand Up @@ -49,7 +48,7 @@ const ModConfStandaloneActivity = () => {
<ListItemButton
onClick={() => {
context.pushPage<ModConfActivityExtra, any>({
component: ModConfActivity,
component: Activities.ModConf,
key: `${metaData.id}_configure_standalone`,
extra: {
indexFile: metaData.main
Expand Down
16 changes: 8 additions & 8 deletions src/activitys/ModuleViewActivity/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { InstallTerminalV2Activity, TerminalActivityExtra } from "@Activitys/InstallTerminalV2Activity";
import { TerminalActivityExtra } from "@Activitys/InstallTerminalV2Activity";
import { AvatarWithProgress } from "@Components/AvatarWithProgress";
import { DropdownButton } from "@Components/DropdownButton";
import { VerifiedIcon } from "@Components/icons/VerifiedIcon";
import { useModuleQueue } from "@Components/ModulesQueue";
import { Page } from "@Components/onsenui/Page";
import { Toolbar } from "@Components/onsenui/Toolbar";
import { useActivity } from "@Hooks/useActivity";
import { useDownloadModule } from "@Hooks/useDownloadModule";
import { useFormatBytes } from "@Hooks/useFormatBytes";
import { useModuleInfo } from "@Hooks/useModuleInfo";
import { useOpenModuleSearch } from "@Hooks/useOpenModuleSearch";
import { useRepos } from "@Hooks/useRepos";
import { useStrings } from "@Hooks/useStrings";
import { useTheme } from "@Hooks/useTheme";
import { VolunteerActivism } from "@mui/icons-material";
import LayersIcon from "@mui/icons-material/Layers";
import TelegramIcon from "@mui/icons-material/Telegram";
import Box from "@mui/material/Box";
import Button from "@mui/material/Button";
import CardMedia from "@mui/material/CardMedia";
import Divider from "@mui/material/Divider";
import Fade from "@mui/material/Fade";
Expand All @@ -30,13 +32,11 @@ import { view } from "@Native/View";
import { useConfirm } from "material-ui-confirm";
import React from "react";
import { Disappear } from "react-disappear";
import { useDocumentTitle } from "usehooks-ts";
import { Activities } from "..";
import { AboutTab } from "./tabs/AboutTabs";
import { OverviewTab } from "./tabs/OverviewTab";
import { VersionsTab } from "./tabs/VersionsTab";
import { useDocumentTitle } from "usehooks-ts";
import LayersIcon from "@mui/icons-material/Layers";
import { useModuleQueue } from "@Components/ModulesQueue";
import Button from "@mui/material/Button";

function a11yProps(index: number) {
return {
Expand Down Expand Up @@ -384,7 +384,7 @@ const ModuleViewActivity = () => {
confirmationText: strings("yes"),
}).then(() => {
context.pushPage<TerminalActivityExtra, {}>({
component: InstallTerminalV2Activity,
component: Activities.InstallTerminal,
key: "InstallTerminalV2Activity",
extra: {
issues: support,
Expand Down Expand Up @@ -430,4 +430,4 @@ const ModuleViewActivity = () => {
);
};

export { ModuleViewActivity };
export default ModuleViewActivity;
30 changes: 14 additions & 16 deletions src/activitys/ModuleViewActivity/tabs/AboutTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import { Page } from "@Components/onsenui/Page";
import { Activities } from "@Activitys/index";
import { Pre } from "@Components/dapi/Pre";
import { useActivity } from "@Hooks/useActivity";
import { useModuleInfo } from "@Hooks/useModuleInfo";
import { useStrings } from "@Hooks/useStrings";
import { useTheme } from "@Hooks/useTheme";
import BugReportIcon from "@mui/icons-material/BugReport";
import FormatAlignLeftIcon from "@mui/icons-material/FormatAlignLeft";
import GitHubIcon from "@mui/icons-material/GitHub";
import VerifiedIcon from "@mui/icons-material/Verified";
import { Avatar, AvatarGroup, Box, Divider, ListSubheader, Stack, Typography } from "@mui/material";
import List from "@mui/material/List";
import ListItem from "@mui/material/ListItem";
import ListItemText from "@mui/material/ListItemText";
import ListItemButton from "@mui/material/ListItemButton";
import BugReportIcon from "@mui/icons-material/BugReport";
import ListItemIcon from "@mui/material/ListItemIcon";
import VerifiedIcon from "@mui/icons-material/Verified";
import GitHubIcon from "@mui/icons-material/GitHub";
import FormatAlignLeftIcon from "@mui/icons-material/FormatAlignLeft";
import FetchTextActivity from "../../FetchTextActivity";
import { useStrings } from "@Hooks/useStrings";
import { useActivity } from "@Hooks/useActivity";
import { useTheme } from "@Hooks/useTheme";
import ListItemText from "@mui/material/ListItemText";
import { os } from "@Native/Os";
import { useModuleInfo } from "@Hooks/useModuleInfo";
import Collapse from "@mui/material/Collapse";
import React from "react";
import { ExpandLess, ExpandMore } from "@mui/icons-material";
import { Avatar, AvatarGroup, Badge, Box, Divider, ListSubheader, Stack, Typography } from "@mui/material";
import { Pre } from "@Components/dapi/Pre";

const preSx = { display: "inline" };

Expand Down Expand Up @@ -55,7 +52,7 @@ const AboutTab = () => {
})
.then((json: LicenseSPX) => {
context.pushPage({
component: FetchTextActivity,
component: Activities.FetchText,
key: "license_" + license,
extra: {
raw_data: json.licenseText,
Expand Down Expand Up @@ -224,3 +221,4 @@ const FeatureItem = React.memo<FeatureItemProps>(({ feat, title, desc, icons })
});

export { AboutTab };

Loading

0 comments on commit 6a5bc33

Please sign in to comment.