From 42da27274d53f65942689c539763d6fa74269924 Mon Sep 17 00:00:00 2001 From: Jack Matthews Date: Mon, 27 Mar 2023 02:30:37 -0400 Subject: [PATCH] findByName-ification --- pnpm-lock.yaml | 16 +++++++++++++--- src/index.tsx | 7 +++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 62b3547..104fc7b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,7 +20,7 @@ devDependencies: rollup: 3.18.0 rollup-plugin-esbuild: 5.0.0_ws62pg4wl3mwyxfcirpjkgqcny rollup-plugin-swc3: 0.8.0_fu2kiraqglh3rwwn5rcdr5r4gq - vendetta-types: 2.3.17 + vendetta-types: 2.4.0 packages: @@ -408,10 +408,18 @@ packages: '@swc/core-win32-x64-msvc': 1.3.37 dev: true + /@types/chroma-js/2.4.0: + resolution: {integrity: sha512-JklMxityrwjBTjGY2anH8JaTx3yjRU3/sEHSblLH1ba5lqcSh1LnImXJZO5peJfXyqKYWjHTGy4s5Wz++hARrw==} + dev: true + /@types/estree/1.0.0: resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==} dev: true + /@types/lodash/4.14.191: + resolution: {integrity: sha512-BdZ5BCCvho3EIXw6wUCXHe7rS53AIDPLE+JzwgT+OsJk53oBfbSmZZ7CX4VaRoN78N+TJpFi9QPlfIVNmJYWxQ==} + dev: true + /@types/prop-types/15.7.5: resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} dev: true @@ -696,10 +704,12 @@ packages: engines: {node: '>= 0.4'} dev: true - /vendetta-types/2.3.17: - resolution: {integrity: sha512-yPF7Rp3ZURvsNWsNV9oFXNd/ddwkJdf4HOTkjSdbbK/3grUHNvuJDWD4fR0ltmuieX4FWueN38lG8lUNMwcc7w==} + /vendetta-types/2.4.0: + resolution: {integrity: sha512-hExPQZZwLBDjbLGh1+qJ4fG6rTrGkYn+En4fEmTywLNLv0b3h1XzrcX8gXxmEaOd7GftE58Vi8J0rLWiTbHdJg==} dependencies: '@react-native-clipboard/clipboard': 1.10.0 + '@types/chroma-js': 2.4.0 + '@types/lodash': 4.14.191 '@types/react': 18.0.26 '@types/react-native': 0.68.1 moment: 2.22.2 diff --git a/src/index.tsx b/src/index.tsx index c991334..6a4013c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,8 +1,7 @@ -import { findByDisplayName, findByProps } from "@vendetta/metro"; +import { findByProps } from "@vendetta/metro"; import { React } from "@vendetta/metro/common"; import { after, before } from "@vendetta/patcher"; import { installPlugin } from "@vendetta/plugins"; -// @ts-expect-error import { installTheme } from "@vendetta/themes"; import { getAssetIDByName } from "@vendetta/ui/assets"; import { Forms } from "@vendetta/ui/components"; @@ -11,8 +10,7 @@ import { APIMessage } from "discord-api-types/v10"; const LazyActionSheet = findByProps("openLazy", "hideActionSheet"); -const { FormRow } = Forms; -const Icon = findByDisplayName("Icon"); +const { FormRow: { default: FormRow, Icon } } = Forms; const HTTP_REGEX = /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g; @@ -36,6 +34,7 @@ export default { leading={} label={`Install ${link}`} onPress={() => { + // @ts-expect-error (link.endsWith(".json") ? installTheme : installPlugin)(link).then(() => { showToast(`Successfully installed ${link}`, getAssetIDByName("Check")); }).catch((e) => {