diff --git a/src/core/i18n/default.json b/src/core/i18n/default.json index 58ccaa2..ccd2a5c 100644 --- a/src/core/i18n/default.json +++ b/src/core/i18n/default.json @@ -1,7 +1,5 @@ { "ABOUT": "About", - "PLUGIN_REFETCH_SUCCESSFUL": "Successfully refetched plugin!", - "PLUGIN_REFETCH_FAILED": "Failed to refetch plugin!", "ACTIONS": "Actions", "ARE_YOU_SURE_TO_CLEAR_DATA": "Are you sure you wish to clear the data of {name}?", "ARE_YOU_SURE_TO_DELETE_PLUGIN": "Are you sure you wish to delete {name}? This will clear all of the plugin's data.", @@ -47,6 +45,7 @@ "INSTALL": "Install", "INSTALL_ADDON": "Install Add-on", "INSTALL_PLUGIN": "Install Plugin", + "INSTALL_REACT_DEVTOOLS": "Install React DevTools", "INSTALL_THEME": "Install Theme", "LINKS": "Links", "LOAD_FROM_CUSTOM_URL": "Load from custom url", @@ -65,8 +64,9 @@ "OPEN_IN_BROWSER": "Open in Browser", "OPERATING_SYSTEM": "Operating System", "OVERFLOW_PLUGIN_SETTINGS": "Plugin settings", - "TOASTS_PLUGIN_UPDATE": "{update, select, true {Enabled} false {Disabled}} updates for {name}.", "PLATFORM": "Platform", + "PLUGIN_REFETCH_FAILED": "Failed to refetch plugin!", + "PLUGIN_REFETCH_SUCCESSFUL": "Successfully refetched plugin!", "PLUGINS": "Plugins", "REFETCH": "Refetch", "RELOAD": "Reload", @@ -75,6 +75,7 @@ "RELOAD_IN_NORMAL_MODE_DESC": "This will reload Discord normally", "RELOAD_IN_SAFE_MODE": "Reload in Safe Mode", "RELOAD_IN_SAFE_MODE_DESC": "This will reload Discord without loading addons", + "RESTART_REQUIRED_TO_TAKE_EFFECT": "Restart required to take effect", "RETRY": "Retry", "RETRY_RENDER": "Retry Render", "SAFE_MODE": "Safe Mode", @@ -90,6 +91,7 @@ "THEMES": "Themes", "THEMES_RELOAD_FOR_CHANGES": "Reload the app to fully apply changes!", "TOASTS_INSTALLED_PLUGIN": "Installed plugin", + "TOASTS_PLUGIN_UPDATE": "{update, select, true {Enabled} false {Disabled}} updates for {name}.", "UH_OH": "Uh oh.", "UNINSTALL": "Uninstall", "UNINSTALL_TITLE": "Uninstall {title}", diff --git a/src/core/ui/settings/pages/Developer.tsx b/src/core/ui/settings/pages/Developer.tsx index bb41f4d..bf85adf 100644 --- a/src/core/ui/settings/pages/Developer.tsx +++ b/src/core/ui/settings/pages/Developer.tsx @@ -1,22 +1,26 @@ import { Strings } from "@core/i18n"; import AssetBrowser from "@core/ui/settings/pages/AssetBrowser"; import { getAssetIDByName } from "@lib/api/assets"; -import { getReactDevToolsProp, getReactDevToolsVersion, isLoaderConfigSupported, isReactDevToolsPreloaded } from "@lib/api/native/loader"; +import { fileExists, removeFile, writeFile } from "@lib/api/native/fs"; +import { getReactDevToolsProp, getReactDevToolsVersion, isLoaderConfigSupported, isReactDevToolsPreloaded, isVendettaLoader } from "@lib/api/native/loader"; import { useProxy } from "@lib/api/storage"; import { connectToDebugger } from "@lib/debug"; import { loaderConfig, settings } from "@lib/settings"; import { FormText } from "@lib/ui/components/discord/Forms"; -import { Stack, TableRow, TableRowGroup, TableSwitchRow, TextInput } from "@lib/ui/components/discord/Redesign"; +import { Button, Stack, TableRow, TableRowGroup, TableSwitchRow, TextInput } from "@lib/ui/components/discord/Redesign"; import { NavigationNative } from "@metro/common"; import { findByProps } from "@metro/filters"; import { semanticColors } from "@ui/color"; import { ErrorBoundary } from "@ui/components"; import { createStyles, TextStyleSheet } from "@ui/styles"; +import { useState } from "react"; import { ScrollView, StyleSheet } from "react-native"; const { hideActionSheet } = findByProps("openLazy", "hideActionSheet"); const { showSimpleActionSheet } = findByProps("showSimpleActionSheet"); +const RDT_EMBED_LINK = "https://raw.githubusercontent.com/amsyarasyiq/rdt-embedder/main/dist.js"; + const useStyles = createStyles({ leadingText: { ...TextStyleSheet["heading-md/semibold"], @@ -26,6 +30,16 @@ const useStyles = createStyles({ }); export default function Developer() { + const [rdtEmbedded, setRdtEmbedded] = useState(false); + const [rdtDownloading, setRdtDownloading] = useState(true); + + React.useEffect(() => { + fileExists("preloads/reactDevtools.js").then(exists => { + setRdtEmbedded(exists); + setRdtDownloading(false); + }); + }, []); + const styles = useStyles(); const navigation = NavigationNative.useNavigation(); @@ -79,7 +93,7 @@ export default function Developer() { placeholder="http://localhost:4040/vendetta.js" label={Strings.BUNNY_URL} />} />} - {isReactDevToolsPreloaded() && } @@ -120,6 +134,37 @@ export default function Developer() { ], })} /> + } + trailing={ +