fix: prevent native settings being opened on non-native

fixes #344
This commit is contained in:
Paul 2021-11-14 18:51:19 +00:00
parent b938f6620b
commit b2a222d7e8
2 changed files with 12 additions and 6 deletions

View file

@ -25,6 +25,8 @@ import styles from "./Settings.module.scss";
import { Text } from "preact-i18n";
import { useContext } from "preact/hooks";
import { isExperimentEnabled } from "../../redux/reducers/experiments";
import RequiresOnline from "../../context/revoltjs/RequiresOnline";
import {
AppContext,
@ -50,7 +52,6 @@ import { Profile } from "./panes/Profile";
import { Sessions } from "./panes/Sessions";
import { Sync } from "./panes/Sync";
import { ThemeShop } from "./panes/ThemeShop";
import { isExperimentEnabled } from "../../redux/reducers/experiments";
export default function Settings() {
const history = useHistory();
@ -126,14 +127,14 @@ export default function Settings() {
title: <Text id="app.settings.pages.experiments.title" />,
},
{
divider: !isExperimentEnabled('theme_shop'),
divider: !isExperimentEnabled("theme_shop"),
category: "revolt",
id: "bots",
icon: <Bot size={20} />,
title: <Text id="app.settings.pages.bots.title" />,
},
{
hidden: !isExperimentEnabled('theme_shop'),
hidden: !isExperimentEnabled("theme_shop"),
divider: true,
id: "theme_shop",
icon: <Store size={20} />,
@ -179,9 +180,11 @@ export default function Settings() {
<Route path="/settings/bots">
<MyBots />
</Route>
{isExperimentEnabled('theme_shop') && <Route path="/settings/theme_shop">
<ThemeShop />
</Route>}
{isExperimentEnabled("theme_shop") && (
<Route path="/settings/theme_shop">
<ThemeShop />
</Route>
)}
<Route path="/settings/feedback">
<Feedback />
</Route>

View file

@ -4,6 +4,9 @@ import Button from "../../../components/ui/Button";
import Checkbox from "../../../components/ui/Checkbox";
export function Native() {
if (typeof window.native === "undefined") return null;
/* eslint-disable react-hooks/rules-of-hooks */
const [config, setConfig] = useState(window.native.getConfig());
const [autoStart, setAutoStart] = useState<boolean | undefined>();
const fetchValue = () => window.native.getAutoStart().then(setAutoStart);