diff --git a/src/lib/constants.ts b/src/lib/constants.ts new file mode 100644 index 0000000..8f2d3cf --- /dev/null +++ b/src/lib/constants.ts @@ -0,0 +1,2 @@ +export const DISCORD_SERVER = "https://discord.gg/n9QQ4XhhJP"; +export const GITHUB = "https://github.com/vendetta-mod"; \ No newline at end of file diff --git a/src/lib/metro/common.ts b/src/lib/metro/common.ts index 7307e4d..451e832 100644 --- a/src/lib/metro/common.ts +++ b/src/lib/metro/common.ts @@ -4,6 +4,7 @@ import { find, findByProps } from "@metro/filters"; export const constants = findByProps("API_HOST"); export const channels = findByProps("getVoiceChannelId"); export const i18n = findByProps("Messages"); +export const url = findByProps("openURL"); export const toasts = find(m => m.open && m.close && !m.startDrag && !m.init && !m.openReplay && !m.setAlwaysOnTop); // React diff --git a/src/ui/settings/components/Settings.tsx b/src/ui/settings/components/General.tsx similarity index 55% rename from src/ui/settings/components/Settings.tsx rename to src/ui/settings/components/General.tsx index b3c0776..71c9731 100644 --- a/src/ui/settings/components/Settings.tsx +++ b/src/ui/settings/components/General.tsx @@ -1,5 +1,7 @@ +import { React, ReactNative as RN, url } from "@metro/common"; +import { DISCORD_SERVER, GITHUB } from "@lib/constants"; import { connectToDebugWS } from "@lib/debug"; -import { React, ReactNative as RN } from "@metro/common"; +import { getAssetIDByName } from "@ui/assets"; import { Forms } from "@ui/components"; import Version from "./Version"; @@ -7,57 +9,71 @@ const { FormRow, FormSection, FormInput } = Forms; const hermesProps = window.HermesInternal.getRuntimeProperties(); const rnVer = RN.Platform.constants.reactNativeVersion; -export default function Settings() { +export default function General() { const [debuggerUrl, setDebuggerUrl] = React.useState(""); const versions = [ { label: "Discord", version: RN.NativeModules.InfoDictionaryManager.Version, + icon: "Discord", }, { label: "React", version: React.version, + icon: "ic_category_16px", }, { label: "React Native", version: `${rnVer.major || 0}.${rnVer.minor || 0}.${rnVer.patch || 0}`, + icon: "mobile", }, { label: "Hermes", - version: `${hermesProps["OSS Release Version"]} ${hermesProps["Build"]}`, - }, - { - label: "Bytecode", - version: hermesProps["Bytecode Version"], + version: `${hermesProps["OSS Release Version"]} ${hermesProps["Build"]} | Bytecode ${hermesProps["Bytecode Version"]}`, + icon: "ic_hammer_and_chisel_24px", }, ]; return ( - <> + {/* Why is there still a divider? */} - + + } + trailing={FormRow.Arrow} + onPress={() => url.openURL(DISCORD_SERVER)} + /> + } + trailing={FormRow.Arrow} + onPress={() => url.openURL(GITHUB)} + /> + + setDebuggerUrl(v)} title="DEBUGGER URL" /> - - - RN.NativeModules.BundleUpdaterManager.reload()} - /> } trailing={FormRow.Arrow} onPress={() => connectToDebugWS(debuggerUrl)} /> + } + trailing={FormRow.Arrow} + onPress={() => RN.NativeModules.BundleUpdaterManager.reload()} + /> - {versions.map((v) => )} + {versions.map((v) => )} - + ) } \ No newline at end of file diff --git a/src/ui/settings/components/SettingsSection.tsx b/src/ui/settings/components/SettingsSection.tsx index ba3cc65..2d4292e 100644 --- a/src/ui/settings/components/SettingsSection.tsx +++ b/src/ui/settings/components/SettingsSection.tsx @@ -1,5 +1,6 @@ import { React } from "@metro/common"; import { Forms } from "@ui/components"; +import { getAssetIDByName } from "@ui/assets"; const { FormRow, FormSection } = Forms; @@ -11,12 +12,14 @@ export default function SettingsSection({ navigation }: SettingsSectionProps) { return ( } trailing={FormRow.Arrow} onPress={() => navigation.push("VendettaSettings")} /> } trailing={FormRow.Arrow} onPress={() => navigation.push("VendettaAssetBrowser")} /> diff --git a/src/ui/settings/components/Version.tsx b/src/ui/settings/components/Version.tsx index 32e81c6..3c537e0 100644 --- a/src/ui/settings/components/Version.tsx +++ b/src/ui/settings/components/Version.tsx @@ -1,18 +1,27 @@ import { React } from "@metro/common"; +import { getAssetIDByName } from "@ui/assets"; +import { showToast } from "@ui/toasts"; import { Forms } from "@ui/components"; +import copyText from "@utils/copyText"; interface VersionProps { label: string; - version: string + version: string; + icon: string; } const { FormRow, FormText } = Forms; -export default function Version({ label, version }: VersionProps) { +export default function Version({ label, version, icon }: VersionProps) { return ( } trailing={() => {version}} + onPress={() => { + copyText(`${label} - ${version}`); + showToast("Copied version to clipboard.", getAssetIDByName("toast_copy_link")) + }} /> ) } \ No newline at end of file diff --git a/src/ui/settings/index.tsx b/src/ui/settings/index.tsx index 4a296ef..8194172 100644 --- a/src/ui/settings/index.tsx +++ b/src/ui/settings/index.tsx @@ -2,8 +2,8 @@ import { React, i18n } from "@metro/common"; import { findByDisplayName } from "@metro/filters"; import { after } from "@lib/patcher"; import findInReactTree from "@utils/findInReactTree"; -import Settings from "./components/Settings"; import SettingsSection from "./components/SettingsSection"; +import General from "./components/General"; import AssetBrowser from "./components/AssetBrowser"; const screensModule = findByDisplayName("getScreens", false); @@ -14,8 +14,8 @@ export default function initSettings() { return { ...ret, VendettaSettings: { - title: "Vendetta Settings", - render: Settings + title: "Vendetta", + render: General }, VendettaAssetBrowser: { title: "Asset Browser",