Skip to content

Commit

Permalink
findByName-ification
Browse files Browse the repository at this point in the history
  • Loading branch information
FieryFlames committed Mar 27, 2023
1 parent 3c292ae commit 42da272
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 13 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;

Expand All @@ -36,6 +34,7 @@ export default {
leading={<Icon source={getAssetIDByName("ic_download_24px")} />}
label={`Install ${link}`}
onPress={() => {
// @ts-expect-error
(link.endsWith(".json") ? installTheme : installPlugin)(link).then(() => {
showToast(`Successfully installed ${link}`, getAssetIDByName("Check"));
}).catch((e) => {
Expand Down

0 comments on commit 42da272

Please sign in to comment.