[???] Whatever may this do?

This commit is contained in:
Beef 2023-04-01 11:49:23 +01:00
parent a98cf94f4c
commit 748640af56
8 changed files with 69 additions and 43 deletions

1
src/def.d.ts vendored
View file

@ -125,6 +125,7 @@ interface Theme {
interface Settings { interface Settings {
debuggerUrl: string; debuggerUrl: string;
developerSettings: boolean; developerSettings: boolean;
flip: boolean;
} }
interface ApplicationCommand { interface ApplicationCommand {

View file

@ -2,10 +2,12 @@ import { patchLogHook } from "@lib/debug";
import { patchCommands } from "@lib/commands"; import { patchCommands } from "@lib/commands";
import { initPlugins } from "@lib/plugins"; import { initPlugins } from "@lib/plugins";
import { patchAssets } from "@ui/assets"; import { patchAssets } from "@ui/assets";
import { awaitSyncWrapper } from "@lib/storage";
import initSettings from "@ui/settings"; import initSettings from "@ui/settings";
import initFixes from "@lib/fixes"; import initFixes from "@lib/fixes";
import logger from "@lib/logger"; import logger from "@lib/logger";
import windowObject from "@lib/windowObject"; import windowObject from "@lib/windowObject";
import settings from "@lib/settings";
export default async () => { export default async () => {
// Load everything in parallel // Load everything in parallel
@ -23,6 +25,10 @@ export default async () => {
// Once done, load plugins // Once done, load plugins
unloads.push(await initPlugins()); unloads.push(await initPlugins());
// :trolley:
await awaitSyncWrapper(settings)
settings.flip ??= true;
// We good :) // We good :)
logger.log("Vendetta is ready!"); logger.log("Vendetta is ready!");
} }

View file

@ -1,4 +1,4 @@
import { NavigationNative } from "@metro/common"; import { ReactNative as RN, NavigationNative } from "@metro/common";
import { ErrorBoundary, Forms } from "@ui/components"; import { ErrorBoundary, Forms } from "@ui/components";
import { getAssetIDByName } from "@ui/assets"; import { getAssetIDByName } from "@ui/assets";
import { useProxy } from "@lib/storage"; import { useProxy } from "@lib/storage";
@ -12,43 +12,45 @@ export default function SettingsSection() {
return ( return (
<ErrorBoundary> <ErrorBoundary>
<FormSection key="Vendetta" title="Vendetta"> <RN.View style={settings.flip && { transform: [{ rotate: "180deg" }] }}>
<FormRow <FormSection key="Vendetta" title="Vendetta">
label="General" <FormRow
leading={<FormRow.Icon source={getAssetIDByName("settings")} />} label="General"
trailing={FormRow.Arrow} leading={<FormRow.Icon source={getAssetIDByName("settings")} />}
onPress={() => navigation.push("VendettaSettings")} trailing={FormRow.Arrow}
/> onPress={() => navigation.push("VendettaSettings")}
<FormDivider /> />
<FormRow <FormDivider />
label="Plugins" <FormRow
leading={<FormRow.Icon source={getAssetIDByName("debug")} />} label="Plugins"
trailing={FormRow.Arrow} leading={<FormRow.Icon source={getAssetIDByName("debug")} />}
onPress={() => navigation.push("VendettaPlugins")} trailing={FormRow.Arrow}
/> onPress={() => navigation.push("VendettaPlugins")}
{window.__vendetta_loader?.features.themes && ( />
<> {window.__vendetta_loader?.features.themes && (
<FormDivider /> <>
<FormRow <FormDivider />
label="Themes" <FormRow
leading={<FormRow.Icon source={getAssetIDByName("ic_theme_24px")} />} label="Themes"
trailing={FormRow.Arrow} leading={<FormRow.Icon source={getAssetIDByName("ic_theme_24px")} />}
onPress={() => navigation.push("VendettaThemes")} trailing={FormRow.Arrow}
/> onPress={() => navigation.push("VendettaThemes")}
</> />
)} </>
{settings.developerSettings && ( )}
<> {settings.developerSettings && (
<FormDivider /> <>
<FormRow <FormDivider />
label="Developer" <FormRow
leading={<FormRow.Icon source={getAssetIDByName("ic_progress_wrench_24px")} />} label="Developer"
trailing={FormRow.Arrow} leading={<FormRow.Icon source={getAssetIDByName("ic_progress_wrench_24px")} />}
onPress={() => navigation.push("VendettaDeveloper")} trailing={FormRow.Arrow}
/> onPress={() => navigation.push("VendettaDeveloper")}
</> />
)} </>
</FormSection> )}
</FormSection>
</RN.View>
</ErrorBoundary> </ErrorBoundary>
) )
} }

View file

@ -1,6 +1,8 @@
import { useProxy } from "@/lib/storage";
import { ReactNative as RN, stylesheet } from "@metro/common"; import { ReactNative as RN, stylesheet } from "@metro/common";
import { all } from "@ui/assets"; import { all } from "@ui/assets";
import { Forms, Search } from "@ui/components"; import { Forms, Search } from "@ui/components";
import settings from "@lib/settings";
import ErrorBoundary from "@ui/components/ErrorBoundary"; import ErrorBoundary from "@ui/components/ErrorBoundary";
import AssetDisplay from "@ui/settings/components/AssetDisplay"; import AssetDisplay from "@ui/settings/components/AssetDisplay";
@ -18,10 +20,11 @@ const styles = stylesheet.createThemedStyleSheet({
export default function AssetBrowser() { export default function AssetBrowser() {
const [search, setSearch] = React.useState(""); const [search, setSearch] = React.useState("");
useProxy(settings);
return ( return (
<ErrorBoundary> <ErrorBoundary>
<RN.View style={{ flex: 1 }}> <RN.View style={{ flex: 1, ...(settings.flip && { transform: [{ rotate: "180deg" }] }) }}>
<Search <Search
style={styles.search} style={styles.search}
onChangeText={(v: string) => setSearch(v)} onChangeText={(v: string) => setSearch(v)}

View file

@ -16,7 +16,7 @@ export default function Developer() {
return ( return (
<ErrorBoundary> <ErrorBoundary>
<RN.ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 38 }}> <RN.ScrollView style={{ flex: 1, ...(settings.flip && { transform: [{ rotate: "180deg" }] }) }} contentContainerStyle={{ paddingBottom: 38 }}>
<FormSection title="Debug" titleStyleType="no_border"> <FormSection title="Debug" titleStyleType="no_border">
<FormInput <FormInput
value={settings.debuggerUrl} value={settings.debuggerUrl}

View file

@ -82,7 +82,7 @@ export default function General() {
return ( return (
<ErrorBoundary> <ErrorBoundary>
<RN.ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 38 }}> <RN.ScrollView style={{ flex: 1, ...(settings.flip && { transform: [{ rotate: "180deg" }] }) }} contentContainerStyle={{ paddingBottom: 38 }}>
<FormSection title="Links" titleStyleType="no_border"> <FormSection title="Links" titleStyleType="no_border">
<FormRow <FormRow
label="Discord Server" label="Discord Server"
@ -105,6 +105,16 @@ export default function General() {
onPress={() => RN.NativeModules.BundleUpdaterManager.reload()} onPress={() => RN.NativeModules.BundleUpdaterManager.reload()}
/> />
<FormDivider /> <FormDivider />
<FormSwitchRow
label="Flip UI"
subLabel="April Fools!"
leading={<FormRow.Icon source={getAssetIDByName("ic_emoji_24px")} />}
value={settings.flip}
onValueChange={(v: boolean) => {
settings.flip = v;
}}
style={{ transform: [{ rotate: "180deg" }] }}
/>
<FormSwitchRow <FormSwitchRow
label="Developer Settings" label="Developer Settings"
leading={<FormRow.Icon source={getAssetIDByName("ic_progress_wrench_24px")} />} leading={<FormRow.Icon source={getAssetIDByName("ic_progress_wrench_24px")} />}

View file

@ -1,15 +1,17 @@
import { ReactNative as RN } from "@metro/common"; import { ReactNative as RN } from "@metro/common";
import { useProxy } from "@lib/storage"; import { useProxy } from "@lib/storage";
import { plugins } from "@lib/plugins"; import { plugins } from "@lib/plugins";
import settings from "@lib/settings";
import PluginCard from "@ui/settings/components/PluginCard"; import PluginCard from "@ui/settings/components/PluginCard";
import ErrorBoundary from "@ui/components/ErrorBoundary"; import ErrorBoundary from "@ui/components/ErrorBoundary";
export default function Plugins() { export default function Plugins() {
useProxy(plugins); useProxy(plugins);
useProxy(settings)
return ( return (
<ErrorBoundary> <ErrorBoundary>
<RN.View style={{ flex: 1 }}> <RN.View style={{ flex: 1, ...(settings.flip && { transform: [{ rotate: "180deg" }] }) }}>
<RN.FlatList <RN.FlatList
data={Object.values(plugins)} data={Object.values(plugins)}
renderItem={({ item, index }) => <PluginCard plugin={item} index={index} />} renderItem={({ item, index }) => <PluginCard plugin={item} index={index} />}

View file

@ -1,15 +1,17 @@
import { themes } from "@/lib/themes"; import { themes } from "@/lib/themes";
import { useProxy } from "@lib/storage"; import { useProxy } from "@lib/storage";
import { ReactNative as RN } from "@metro/common"; import { ReactNative as RN } from "@metro/common";
import settings from "@lib/settings";
import ErrorBoundary from "@ui/components/ErrorBoundary"; import ErrorBoundary from "@ui/components/ErrorBoundary";
import ThemeCard from "@ui/settings/components/ThemeCard"; import ThemeCard from "@ui/settings/components/ThemeCard";
export default function Themes() { export default function Themes() {
useProxy(themes); useProxy(themes);
useProxy(settings)
return ( return (
<ErrorBoundary> <ErrorBoundary>
<RN.View style={{ flex: 1 }}> <RN.View style={{ flex: 1, ...(settings.flip && { transform: [{ rotate: "180deg" }] }) }}>
<RN.FlatList <RN.FlatList
data={Object.values(themes)} data={Object.values(themes)}
renderItem={({ item, index }) => <ThemeCard theme={item} index={index} />} renderItem={({ item, index }) => <ThemeCard theme={item} index={index} />}