diff --git a/src/plugins/rpcEditor/ReplaceSettings.tsx b/src/plugins/rpcEditor/ReplaceSettings.tsx index 8f93e6619..881d0b252 100644 --- a/src/plugins/rpcEditor/ReplaceSettings.tsx +++ b/src/plugins/rpcEditor/ReplaceSettings.tsx @@ -1,8 +1,8 @@ /* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ +* Vencord, a Discord client mod +* Copyright (c) 2024 Vendicated and contributors +* SPDX-License-Identifier: GPL-3.0-or-later +*/ import { CheckedTextInput } from "@components/CheckedTextInput"; import { Margins } from "@utils/margins"; @@ -25,23 +25,6 @@ interface RpcApp { flags: number; } -const RPCUtils = findByPropsLazy("fetchApplicationsRPC", "getRemoteIconURL"); - -const cachedApps: any = {}; -async function lookupApp(appId: string): Promise { - if (cachedApps[appId]) return cachedApps[appId]; - const socket: any = {}; - try { - await RPCUtils.fetchApplicationsRPC(socket, appId); - console.log(`Lookup finished for ${socket.application.name}`); - cachedApps[appId] = socket.application; - return socket.application; - } catch { - console.log(`Lookup failed for ${appId}`); - return null; - } -} - function isValidSnowflake(v: string) { const regex = /^\d{17,20}$/; return regex.test(v) && !Number.isNaN(SnowflakeUtils.extractTimestamp(v)); @@ -49,7 +32,6 @@ function isValidSnowflake(v: string) { export function ReplaceTutorial() { const activities: Activity[] = PresenceStore.getActivities(UserStore.getCurrentUser().id); - console.log(activities); return ( <> IDs of currently running activities @@ -77,8 +59,7 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) { appIds[index][key] = val; if (val && key === "appId") { - const tempApp = await lookupApp(val.toString()); - appIds[index].appName = tempApp?.name || "Unknown"; + appIds[index].appName = "Unknown"; } if (appIds[index].appId === "" && index !== appIds.length - 1) @@ -92,9 +73,9 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) { <> { appIds.map((setting, i) => - + { - setting.appName !== "Unknown" ? + setting.appId ? { @@ -103,10 +84,10 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) { className={Margins.bottom8} hideBorder={true} > - Edit the {setting.appName} app - : Add new application + Edit the app + : Add new application } - Application ID + Application ID { @@ -117,25 +98,24 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) { } /> { - setting.appName !== "Unknown" ? - <> - New activity type - { + onChange(value, i, "activityType"); + }} + className={Margins.top8} + isSelected={value => setting.newActivityType === value} + serialize={identity} + /> + } )