convert non lazy finds to test with reporter
This commit is contained in:
parent
9dd00fb766
commit
08036f7af2
|
@ -19,7 +19,9 @@
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByProps } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
|
|
||||||
|
const { updateGuildNotificationSettings } = findByPropsLazy("updateGuildNotificationSettings");
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
guild: {
|
guild: {
|
||||||
|
@ -63,7 +65,7 @@ export default definePlugin({
|
||||||
|
|
||||||
handleMute(guildId: string | null) {
|
handleMute(guildId: string | null) {
|
||||||
if (guildId === "@me" || guildId === "null" || guildId == null) return;
|
if (guildId === "@me" || guildId === "null" || guildId == null) return;
|
||||||
findByProps("updateGuildNotificationSettings").updateGuildNotificationSettings(guildId,
|
updateGuildNotificationSettings(guildId,
|
||||||
{
|
{
|
||||||
muted: settings.store.guild,
|
muted: settings.store.guild,
|
||||||
suppress_everyone: settings.store.everyone,
|
suppress_everyone: settings.store.everyone,
|
||||||
|
|
|
@ -20,9 +20,11 @@ import { definePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { saveFile } from "@utils/web";
|
import { saveFile } from "@utils/web";
|
||||||
import { findByProps } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
import { Clipboard, ComponentDispatch } from "@webpack/common";
|
import { Clipboard, ComponentDispatch } from "@webpack/common";
|
||||||
|
|
||||||
|
const ctxMenuCallbacks = findByPropsLazy("contextMenuCallbackNative");
|
||||||
|
|
||||||
async function fetchImage(url: string) {
|
async function fetchImage(url: string) {
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
if (res.status !== 200) return;
|
if (res.status !== 200) return;
|
||||||
|
@ -55,7 +57,6 @@ export default definePlugin({
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
if (settings.store.addBack) {
|
if (settings.store.addBack) {
|
||||||
const ctxMenuCallbacks = findByProps("contextMenuCallbackNative");
|
|
||||||
window.removeEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackWeb);
|
window.removeEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackWeb);
|
||||||
window.addEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackNative);
|
window.addEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackNative);
|
||||||
this.changedListeners = true;
|
this.changedListeners = true;
|
||||||
|
@ -64,7 +65,6 @@ export default definePlugin({
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
if (this.changedListeners) {
|
if (this.changedListeners) {
|
||||||
const ctxMenuCallbacks = findByProps("contextMenuCallbackNative");
|
|
||||||
window.removeEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackNative);
|
window.removeEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackNative);
|
||||||
window.addEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackWeb);
|
window.addEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackWeb);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { findByProps, findByPropsLazy } from "@webpack";
|
import { findByPropsLazy, findExportedComponentLazy } from "@webpack";
|
||||||
import type { ComponentType, PropsWithChildren, ReactNode, Ref } from "react";
|
import type { ComponentType, PropsWithChildren, ReactNode, Ref } from "react";
|
||||||
|
|
||||||
import { LazyComponent } from "./react";
|
import { LazyComponent } from "./react";
|
||||||
|
@ -118,7 +118,7 @@ export type ImageModal = ComponentType<{
|
||||||
shouldHideMediaOptions?: boolean;
|
shouldHideMediaOptions?: boolean;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export const ImageModal = LazyComponent(() => findByProps("ImageModal").ImageModal as ImageModal);
|
export const ImageModal = findExportedComponentLazy("ImageModal") as ImageModal;
|
||||||
|
|
||||||
export const ModalRoot = LazyComponent(() => Modals.ModalRoot);
|
export const ModalRoot = LazyComponent(() => Modals.ModalRoot);
|
||||||
export const ModalHeader = LazyComponent(() => Modals.ModalHeader);
|
export const ModalHeader = LazyComponent(() => Modals.ModalHeader);
|
||||||
|
|
Loading…
Reference in a new issue