Skip to content

Commit

Permalink
Make more finds not depend on non mangled keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Jan 29, 2025
1 parent 7415367 commit 81dda2c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/plugins/betterFolders/FolderSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
*/

import ErrorBoundary from "@components/ErrorBoundary";
import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { useStateFromStores } from "@webpack/common";
import { findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { Animations, useStateFromStores } from "@webpack/common";
import type { CSSProperties } from "react";

import { ExpandedGuildFolderStore, settings } from ".";

const ChannelRTCStore = findStoreLazy("ChannelRTCStore");
const Animations = findByPropsLazy("a", "animated", "useTransition");
const GuildsBar = findComponentByCodeLazy('("guildsnav")');

export default ErrorBoundary.wrap(guildsBarProps => {
Expand Down
5 changes: 1 addition & 4 deletions src/plugins/reviewDB/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
import { DataStore } from "@api/index";
import { Logger } from "@utils/Logger";
import { openModal } from "@utils/modal";
import { findByPropsLazy } from "@webpack";
import { showToast, Toasts, UserStore } from "@webpack/common";
import { OAuth2AuthorizeModal, showToast, Toasts, UserStore } from "@webpack/common";

import { ReviewDBAuth } from "./entities";

const DATA_STORE_KEY = "rdb-auth";

const { OAuth2AuthorizeModal } = findByPropsLazy("OAuth2AuthorizeModal");

export let Auth: ReviewDBAuth = {};

export async function initAuth() {
Expand Down
7 changes: 5 additions & 2 deletions src/plugins/webContextMenus.web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { saveFile } from "@utils/web";
import { findByPropsLazy } from "@webpack";
import { filters, mapMangledModuleLazy } from "@webpack";
import { Clipboard, ComponentDispatch } from "@webpack/common";

const ctxMenuCallbacks = findByPropsLazy("contextMenuCallbackNative");
const ctxMenuCallbacks = mapMangledModuleLazy('.tagName)==="TEXTAREA"||', {
contextMenuCallbackWeb: filters.byCode('.tagName)==="INPUT"||'),
contextMenuCallbackNative: filters.byCode('.tagName)==="TEXTAREA"||')
});

async function fetchImage(url: string) {
const res = await fetch(url);
Expand Down
5 changes: 5 additions & 0 deletions src/webpack/common/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,8 @@ export const MaskedLink = waitForComponent<t.MaskedLink>("MaskedLink", filters.c
export const Timestamp = waitForComponent<t.Timestamp>("Timestamp", filters.componentByCode("#{intl::MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL}"));
export const Flex = waitForComponent<t.Flex>("Flex", ["Justify", "Align", "Wrap"]);
export const OAuth2AuthorizeModal = waitForComponent("OAuth2AuthorizeModal", filters.componentByCode(".authorize),children:", ".contentBackground"));

export const Animations = mapMangledModuleLazy(".assign({colorNames:", {
Transition: filters.componentByCode('["items","children"]', ",null,"),
animated: filters.byProps("div", "text")
});

0 comments on commit 81dda2c

Please sign in to comment.