FriendsSince: Remove workaround for stable compatibility

This commit is contained in:
Nuckyz 2024-04-26 18:31:22 -03:00
parent c10466f607
commit fafd46d202
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -7,22 +7,12 @@
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { getCurrentChannel } from "@utils/discord"; import { getCurrentChannel } from "@utils/discord";
import { makeLazy } from "@utils/lazy";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { filters, find, findByPropsLazy, handleModuleNotFound } from "@webpack"; import { findByPropsLazy } from "@webpack";
import { React, RelationshipStore } from "@webpack/common"; import { React, RelationshipStore } from "@webpack/common";
const { Heading, Text } = findByPropsLazy("Heading", "Text"); const { Heading, Text } = findByPropsLazy("Heading", "Text");
// Workaround for module differing on stable & canary const container = findByPropsLazy("memberSinceWrapper");
// FIXME: remove once merged into stable
const getMemberSinceContainer = makeLazy(() => {
for (const name of ["memberSinceWrapper", "memberSinceContainer"]) {
const mod = find(filters.byProps(name), { isIndirect: true });
if (mod) return mod[name];
}
handleModuleNotFound("findByProps", "memberSinceWrapper/memberSinceContainer");
return "";
});
const { getCreatedAtDate } = findByPropsLazy("getCreatedAtDate"); const { getCreatedAtDate } = findByPropsLazy("getCreatedAtDate");
const clydeMoreInfo = findByPropsLazy("clydeMoreInfo"); const clydeMoreInfo = findByPropsLazy("clydeMoreInfo");
const locale = findByPropsLazy("getLocale"); const locale = findByPropsLazy("getLocale");
@ -59,7 +49,7 @@ export default definePlugin({
Friends Since Friends Since
</Heading> </Heading>
<div className={getMemberSinceContainer()}> <div className={container.memberSinceWrapper}>
{!!getCurrentChannel()?.guild_id && ( {!!getCurrentChannel()?.guild_id && (
<svg <svg
aria-hidden="true" aria-hidden="true"