ViewIcons: Now opens icons in image viewer

This commit is contained in:
Vendicated 2022-09-08 22:25:21 +02:00
parent e52225304e
commit 6099179f02
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
3 changed files with 26 additions and 7 deletions

View file

@ -1,12 +1,31 @@
import { REACT_GLOBAL } from "../utils/constants";
import IpcEvents from "../utils/IpcEvents";
import { Modal, openModal } from "../utils/modal";
import definePlugin from '../utils/types';
import { filters, waitFor } from "../webpack";
const OPEN_URL = `VencordNative.ipc.invoke("${IpcEvents.OPEN_EXTERNAL}",`;
let ImageModal: any;
let renderMaskedLink: any;
waitFor(filters.byDisplayName("ImageModal"), m => ImageModal = m.default);
waitFor("renderMaskedLinkComponent", m => renderMaskedLink = m.renderMaskedLinkComponent);
const OPEN_URL = "Vencord.Plugins.plugins.ViewIcons.openImage(";
export default definePlugin({
name: "ViewIcons",
author: "Vendicated",
description: "Makes Avatars/Banners in user profiles clickable, and adds Guild Context Menu Entries to View Banner/Icon. Crashes if you don't have Developer Mode enabled, will fix in the future.",
openImage(url: string) {
openModal(() => (
<ImageModal
shouldAnimate={true}
original={url}
src={url}
renderLinkComponent={renderMaskedLink}
/>
), { size: Modal.ModalSize.DYNAMIC });
},
patches: [
{
find: "UserProfileModalHeader",