diff --git a/src/equicordplugins/fakeProfileThemesAndEffects/index.tsx b/src/equicordplugins/fakeProfileThemesAndEffects/index.tsx index e54dc57e5..e9ffa290d 100644 --- a/src/equicordplugins/fakeProfileThemesAndEffects/index.tsx +++ b/src/equicordplugins/fakeProfileThemesAndEffects/index.tsx @@ -4,11 +4,11 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -import { definePluginSettings } from "@api/Settings"; +import { definePluginSettings, Settings } from "@api/Settings"; import { EquicordDevs } from "@utils/constants"; import { canonicalizeMatch, canonicalizeReplace } from "@utils/patches"; import definePlugin, { OptionType } from "@utils/types"; -import { useMemo } from "@webpack/common"; +import { showToast, Toasts, useMemo } from "@webpack/common"; import { Builder, type BuilderProps, setProfileEffectModal, settingsAboutComponent } from "./components"; import { ProfileEffectRecord, ProfileEffectStore } from "./lib/profileEffects"; @@ -163,6 +163,12 @@ export default definePlugin({ } ], + start: () => { + const { FakeProfileThemesAndEffects, FakeProfileThemes } = Settings.plugins; + if (FakeProfileThemes.enabled && FakeProfileThemesAndEffects.enabled) FakeProfileThemes.enabled = false; + showToast("Disabled FakeProfileThemes as FakeProfileThemesAndEffects is enabled", Toasts.Type.SUCCESS); + }, + addFPTEBuilder: (guild?: BuilderProps["guild"]) => settings.store.hideBuilder ? null : , onApply(_effectId?: string) { }, @@ -178,23 +184,24 @@ export default definePlugin({ ProfileEffectSelection: () => null, - usePurchases: () => useMemo( - () => new Map(ProfileEffectStore.profileEffects.map(effect => [ - effect.id, - { items: new ProfileEffectRecord(effect) } - ])), - [ProfileEffectStore.profileEffects] - ), + usePurchases: () => useMemo(() => { + return new Map( + ProfileEffectStore.getAllProfileEffects().map(effect => [ + effect.id, + { items: new ProfileEffectRecord(effect) } + ]) + ); + }, [ProfileEffectStore.getAllProfileEffects()]), useProfileEffectSections: (origSections: Record[]) => useMemo( () => { origSections.splice(1); origSections[0].items.splice(1); - for (const effect of ProfileEffectStore.profileEffects) + for (const effect of ProfileEffectStore.getAllProfileEffects()) origSections[0].items.push(new ProfileEffectRecord(effect)); return origSections; }, - [ProfileEffectStore.profileEffects] + [ProfileEffectStore.getAllProfileEffects()] ), settings, diff --git a/src/equicordplugins/fakeProfileThemesAndEffects/lib/profileEffects.ts b/src/equicordplugins/fakeProfileThemesAndEffects/lib/profileEffects.ts index aef85ca97..04f93cc8c 100644 --- a/src/equicordplugins/fakeProfileThemesAndEffects/lib/profileEffects.ts +++ b/src/equicordplugins/fakeProfileThemesAndEffects/lib/profileEffects.ts @@ -9,13 +9,10 @@ import { findByCodeLazy, findStoreLazy } from "@webpack"; import type { SnakeCasedProperties } from "type-fest"; export const ProfileEffectStore: FluxStore & { - canFetch: () => boolean; + canFetchAll: () => boolean; getProfileEffectById: (effectId: string) => ProfileEffect | undefined; - hasFetched: () => boolean; - readonly fetchError: Error | undefined; - readonly isFetching: boolean; - readonly profileEffects: ProfileEffect[]; - readonly tryItOutId: string | null; + isFetchingAll: () => boolean; + getAllProfileEffects: () => ProfileEffect[]; } = findStoreLazy("ProfileEffectStore"); export const ProfileEffectRecord: { @@ -42,7 +39,7 @@ export interface ProfileEffectConfig { animationType: number; description: string; effects: { - duartion: number; + duration: number; height: number; loop: boolean; loopDelay: number; @@ -57,7 +54,7 @@ export interface ProfileEffectConfig { }[]; id: string; reducedMotionSrc: string; - sku_id: string; + skuId: string; staticFrameSrc?: string; thumbnailPreviewSrc: string; title: string; diff --git a/src/equicordplugins/fakeProfileThemesAndEffects/lib/userProfile.ts b/src/equicordplugins/fakeProfileThemesAndEffects/lib/userProfile.ts index f8f6e955b..3c90fb328 100644 --- a/src/equicordplugins/fakeProfileThemesAndEffects/lib/userProfile.ts +++ b/src/equicordplugins/fakeProfileThemesAndEffects/lib/userProfile.ts @@ -6,11 +6,13 @@ import { settings } from ".."; import { decodeColor, decodeColorsLegacy, decodeEffect, extractFPTE } from "./fpte"; +import { ProfileEffectStore } from "./profileEffects"; export interface UserProfile { bio: string; premiumType: number | null | undefined; profileEffectId: string | undefined; + profileEffect: any; themeColors: [primaryColor: number, accentColor: number] | undefined; } @@ -26,6 +28,7 @@ function updateProfileThemeColors(profile: UserProfile, primary: number, accent: function updateProfileEffectId(profile: UserProfile, id: bigint) { if (id > -1n) { + profile.profileEffect = ProfileEffectStore.getProfileEffectById(id.toString()); profile.profileEffectId = id.toString(); profile.premiumType = 2; }