diff --git a/plugins/rose-plugs/src/ui/PluginDetailSheet.tsx b/plugins/rose-plugs/src/ui/PluginDetailSheet.tsx deleted file mode 100644 index 064d83a..0000000 --- a/plugins/rose-plugs/src/ui/PluginDetailSheet.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { React, ReactNative } from "@vendetta/metro/common"; -import { plugins as installedPlugins, installPlugin } from "@vendetta/plugins"; -import { showToast } from "@vendetta/ui/toasts"; -import PrimaryButton from "@shared/ui/PrimaryButton"; -import { NexusPlugin } from "../lib/nexusApi"; - -const { ScrollView, Text } = ReactNative; - -// Confirmed live: this could get stuck on "Installing..." forever - the timeout below is a safety -// net so a hung installPlugin() call can't leave the button stuck indefinitely. -function withTimeout(promise: Promise, ms: number): Promise { - return new Promise((resolve, reject) => { - const timer = setTimeout(() => reject(new Error("Timed out")), ms); - promise.then( - (v) => { clearTimeout(timer); resolve(v); }, - (e) => { clearTimeout(timer); reject(e); }, - ); - }); -} - -export default function PluginDetailSheet({ plugin }: { plugin: NexusPlugin }) { - const [installing, setInstalling] = React.useState(false); - const alreadyInstalled = plugin.installUrl in installedPlugins; - - const onInstall = React.useCallback(() => { - setInstalling(true); - withTimeout(installPlugin(plugin.installUrl), 20000) - .then(() => showToast(`${plugin.name} installed`)) - .catch((e: any) => showToast(`Install failed: ${e?.message ?? e}`)) - .finally(() => setInstalling(false)); - }, [plugin.installUrl]); - - return ( - - {plugin.name} - {plugin.category} - {plugin.tagline || plugin.description} - {plugin.status && plugin.status !== "default" && ( - - {plugin.status.toUpperCase()} - - )} - - - ); -} diff --git a/plugins/rose-plugs/src/ui/PluginsBrowser.tsx b/plugins/rose-plugs/src/ui/PluginsBrowser.tsx index 20adc21..ffcfde2 100644 --- a/plugins/rose-plugs/src/ui/PluginsBrowser.tsx +++ b/plugins/rose-plugs/src/ui/PluginsBrowser.tsx @@ -1,13 +1,11 @@ import { React, ReactNative } from "@vendetta/metro/common"; import { plugins as installedPlugins, installPlugin } from "@vendetta/plugins"; -import { showCustomAlert } from "@vendetta/ui/alerts"; import { showToast } from "@vendetta/ui/toasts"; import SettingsScaffold from "@shared/ui/SettingsScaffold"; import NoteBox from "@shared/ui/NoteBox"; import PrimaryButton from "@shared/ui/PrimaryButton"; import { TableRow, TableRowGroup } from "@shared/ui/table"; import { fetchNexusPlugins, NexusPlugin } from "../lib/nexusApi"; -import PluginDetailSheet from "./PluginDetailSheet"; const { Text, View, TouchableOpacity } = ReactNative; @@ -117,7 +115,6 @@ export default function PluginsBrowser() { )} } - onPress={() => showCustomAlert(PluginDetailSheet, { plugin })} /> ); })}