ViewIcons: Fix finding ImageModal and props passing to MaskedLink (#442)

* Fix finding ImageModal and props passing to MaskedLink

* gonna stick this here
This commit is contained in:
Nuckyz 2023-01-21 10:37:36 -03:00 committed by GitHub
parent 6e44b8c47e
commit 64180362fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -158,7 +158,7 @@ export default definePlugin({
find: '.displayName="LocalActivityStore"', find: '.displayName="LocalActivityStore"',
replacement: { replacement: {
match: /(?<activities>.)\.push\(.\({type:.\..{1,3}\.LISTENING.+?\)\)/, match: /(?<activities>.)\.push\(.\({type:.\..{1,3}\.LISTENING.+?\)\)/,
replace: "$&;$<activities>=$<activities>.filter(Vencord.Plugins.plugins.IgnoreActivities.isActivityIgnored);" replace: "$&;$<activities>=$<activities>.filter(Vencord.Plugins.plugins.IgnoreActivities.isActivityNotIgnored);"
} }
}], }],
@ -205,7 +205,7 @@ export default definePlugin({
); );
}, },
isActivityIgnored(props: { type: number; application_id?: string; name?: string; }) { isActivityNotIgnored(props: { type: number; application_id?: string; name?: string; }) {
if (props.type === 0) { if (props.type === 0) {
if (props.application_id !== undefined) return !ignoredActivitiesCache.has(props.application_id); if (props.application_id !== undefined) return !ignoredActivitiesCache.has(props.application_id);
else { else {

View file

@ -20,11 +20,11 @@ import { Devs } from "@utils/constants";
import { LazyComponent } from "@utils/misc"; import { LazyComponent } from "@utils/misc";
import { ModalRoot, ModalSize, openModal } from "@utils/modal"; import { ModalRoot, ModalSize, openModal } from "@utils/modal";
import { PluginDef } from "@utils/types"; import { PluginDef } from "@utils/types";
import { find, findByPropsLazy } from "@webpack"; import { find, findByCode, findByPropsLazy } from "@webpack";
import { Menu } from "@webpack/common"; import { Menu } from "@webpack/common";
import type { Guild } from "discord-types/general"; import type { Guild } from "discord-types/general";
const ImageModal = LazyComponent(() => find(m => m.prototype?.render?.toString().includes("this.renderMobileCloseButton()"))); const ImageModal = LazyComponent(() => findByCode(".MEDIA_MODAL_CLOSE,"));
const MaskedLink = LazyComponent(() => find(m => m.type?.toString().includes("MASKED_LINK)"))); const MaskedLink = LazyComponent(() => find(m => m.type?.toString().includes("MASKED_LINK)")));
const GuildBannerStore = findByPropsLazy("getGuildBannerURL"); const GuildBannerStore = findByPropsLazy("getGuildBannerURL");
@ -48,7 +48,7 @@ export default new class ViewIcons implements PluginDef {
shouldAnimate={true} shouldAnimate={true}
original={url} original={url}
src={url} src={url}
renderLinkComponent={() => <MaskedLink />} renderLinkComponent={MaskedLink}
/> />
</ModalRoot> </ModalRoot>
)); ));