diff options
author | Vendicated <vendicated@riseup.net> | 2022-10-14 22:38:49 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-10-14 22:40:20 +0200 |
commit | 0d996633f201b2ab95d8b9dc376a7da2dcca315d (patch) | |
tree | db6e1d1a9a4f863dd20f8380f5ce240854c94834 /src/plugins/viewIcons.tsx | |
parent | a4e98f92520306dad8bb1cdd9884f0b331fd0bdd (diff) | |
download | Vencord-0d996633f201b2ab95d8b9dc376a7da2dcca315d.tar.gz Vencord-0d996633f201b2ab95d8b9dc376a7da2dcca315d.tar.bz2 Vencord-0d996633f201b2ab95d8b9dc376a7da2dcca315d.zip |
ViewIcons: Use ImageModal again
Diffstat (limited to 'src/plugins/viewIcons.tsx')
-rw-r--r-- | src/plugins/viewIcons.tsx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/viewIcons.tsx b/src/plugins/viewIcons.tsx index 2b404f2..a55b8b8 100644 --- a/src/plugins/viewIcons.tsx +++ b/src/plugins/viewIcons.tsx @@ -1,6 +1,12 @@ import { Devs } from "../utils/constants"; -import IpcEvents from "../utils/IpcEvents"; import definePlugin from "../utils/types"; +import { lazyWebpack, makeLazy } from "../utils/misc"; +import { ModalSize, openModal } from "../utils/modal"; +import { find } from "../webpack"; +import { React } from "../webpack/common"; + +const ImageModal = lazyWebpack(m => m.prototype?.render?.toString().includes("OPEN_ORIGINAL_IMAGE")); +const getMaskedLink = makeLazy(() => find(m => m.type?.toString().includes("MASKED_LINK)"))); const OPEN_URL = "Vencord.Plugins.plugins.ViewIcons.openImage("; export default definePlugin({ @@ -9,16 +15,14 @@ export default definePlugin({ description: "Makes Avatars/Banners in user profiles clickable, and adds Guild Context Menu Entries to View Banner/Icon.", openImage(url: string) { - VencordNative.ipc.invoke(IpcEvents.OPEN_EXTERNAL, url); - // husk - /* openModal(() => ( + openModal(() => ( <ImageModal shouldAnimate={true} original={url} src={url} - renderLinkComponent={renderMaskedLink} + renderLinkComponent={props => React.createElement(getMaskedLink(), props)} /> - ), { size: Modal.ModalSize.DYNAMIC }); */ + ), { size: ModalSize.DYNAMIC }); }, patches: [ |