Remove obsolete mapMangledModule ~ modules are no longer mangled

This commit is contained in:
V 2023-11-23 03:11:17 +01:00
parent 6869705673
commit 63451bad25
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
12 changed files with 46 additions and 90 deletions

View file

@ -19,11 +19,9 @@
import { Devs } from "@utils/constants";
import { insertTextIntoChatInputBox } from "@utils/discord";
import definePlugin from "@utils/types";
import { filters, mapMangledModuleLazy } from "@webpack";
import { findByPropsLazy } from "@webpack";
const ExpressionPickerState = mapMangledModuleLazy('name:"expression-picker-last-active-view"', {
close: filters.byCode("activeView:null", "setState")
});
const { closeExpressionPicker } = findByPropsLazy("closeExpressionPicker");
export default definePlugin({
name: "GifPaste",
@ -41,7 +39,7 @@ export default definePlugin({
handleSelect(gif?: { url: string; }) {
if (gif) {
insertTextIntoChatInputBox(gif.url + " ");
ExpressionPickerState.close();
closeExpressionPicker();
}
}
});

View file

@ -20,7 +20,7 @@ import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { ContextMenu, FluxDispatcher, Menu } from "@webpack/common";
import { ContextMenuApi, FluxDispatcher, Menu } from "@webpack/common";
import { Channel, Message } from "discord-types/general";
interface Sticker {
@ -183,6 +183,6 @@ export default definePlugin({
}
) {
if (!(props.message as any).deleted)
ContextMenu.open(event, () => <GreetMenu {...props} />);
ContextMenuApi.openContextMenu(event, () => <GreetMenu {...props} />);
}
});

View file

@ -23,7 +23,7 @@ import { makeRange } from "@components/PluginSettings/components";
import { Devs } from "@utils/constants";
import { debounce } from "@utils/debounce";
import definePlugin, { OptionType } from "@utils/types";
import { ContextMenu, Menu, React, ReactDOM } from "@webpack/common";
import { ContextMenuApi, Menu, React, ReactDOM } from "@webpack/common";
import type { Root } from "react-dom/client";
import { Magnifier, MagnifierProps } from "./components/Magnifier";
@ -89,7 +89,7 @@ const imageContextMenuPatch: NavContextMenuPatchCallback = children => () => {
checked={settings.store.square}
action={() => {
settings.store.square = !settings.store.square;
ContextMenu.close();
ContextMenuApi.closeContextMenu();
}}
/>
<Menu.MenuCheckboxItem
@ -98,7 +98,7 @@ const imageContextMenuPatch: NavContextMenuPatchCallback = children => () => {
checked={settings.store.nearestNeighbour}
action={() => {
settings.store.nearestNeighbour = !settings.store.nearestNeighbour;
ContextMenu.close();
ContextMenuApi.closeContextMenu();
}}
/>
<Menu.MenuControlItem

View file

@ -21,7 +21,7 @@ import { Flex } from "@components/Flex";
import { InfoIcon, OwnerCrownIcon } from "@components/Icons";
import { getUniqueUsername } from "@utils/discord";
import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import { ContextMenu, FluxDispatcher, GuildMemberStore, Menu, PermissionsBits, Text, Tooltip, useEffect, UserStore, useState, useStateFromStores } from "@webpack/common";
import { ContextMenuApi, FluxDispatcher, GuildMemberStore, Menu, PermissionsBits, Text, Tooltip, useEffect, UserStore, useState, useStateFromStores } from "@webpack/common";
import type { Guild } from "discord-types/general";
import { settings } from "..";
@ -111,7 +111,7 @@ function RolesAndUsersPermissionsComponent({ permissions, guild, modalProps, hea
className={cl("perms-list-item", { "perms-list-item-active": selectedItemIndex === index })}
onContextMenu={e => {
if ((settings.store as any).unsafeViewAsRole && permission.type === PermissionType.Role)
ContextMenu.open(e, () => (
ContextMenuApi.openContextMenu(e, () => (
<RoleContextMenu
guild={guild}
roleId={permission.id!}
@ -194,7 +194,7 @@ function RoleContextMenu({ guild, roleId, onClose }: { guild: Guild; roleId: str
return (
<Menu.Menu
navId={cl("role-context-menu")}
onClose={ContextMenu.close}
onClose={ContextMenuApi.closeContextMenu}
aria-label="Role Options"
>
<Menu.MenuItem

View file

@ -24,7 +24,7 @@ import { ImageIcon, LinkIcon, OpenExternalIcon } from "@components/Icons";
import { debounce } from "@utils/debounce";
import { openImageModal } from "@utils/discord";
import { classes, copyWithToast } from "@utils/misc";
import { ContextMenu, FluxDispatcher, Forms, Menu, React, useEffect, useState, useStateFromStores } from "@webpack/common";
import { ContextMenuApi, FluxDispatcher, Forms, Menu, React, useEffect, useState, useStateFromStores } from "@webpack/common";
import { SpotifyStore, Track } from "./SpotifyStore";
@ -104,7 +104,7 @@ function CopyContextMenu({ name, path }: { name: string; path: string; }) {
function makeContextMenu(name: string, path: string) {
return (e: React.MouseEvent<HTMLElement, MouseEvent>) =>
ContextMenu.open(e, () => <CopyContextMenu name={name} path={path} />);
ContextMenuApi.openContextMenu(e, () => <CopyContextMenu name={name} path={path} />);
}
function Controls() {
@ -277,7 +277,7 @@ function Info({ track }: { track: Track; }) {
alt="Album Image"
onClick={() => setCoverExpanded(!coverExpanded)}
onContextMenu={e => {
ContextMenu.open(e, () => <AlbumContextMenu track={track} />);
ContextMenuApi.openContextMenu(e, () => <AlbumContextMenu track={track} />);
}}
/>
)}