Equicord/src/equicordplugins/profileSets/index.tsx
Eazvy 189ab429bb
profileSets avatar / types fix (#794)
* profileSets avatar / types fix

- Fix avatar pending payload flow to use USER_PROFILE_SETTINGS_SET_PENDING_AVATAR with NEW_ASSET imageUri payload.

- Resolve TypeScript typing issues around IconUtils avatar/banner URL resolution without any casts.

- Remove debug logging and legacy pending dispatch paths; keep recents and profile pending behavior aligned with current Discord profile settings.

- Clean up profileSets rulebook compliance issues (nullish coalescing/defaults, typed preset field updates, no logger/console usage).

* profilesets: remove display name sanitizer subscription

* fixed checks

* fix pending profile event flow

* skip collectible dispatch when already equipped

* fixed checks

* Remove empty stop method from profile set plugin

Removed the empty stop method from the profile set plugin.

* bleh

* Update src/equicordplugins/profileSets/utils/profile.ts

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update src/equicordplugins/profileSets/utils/profile.ts

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* t

* fix fallback guard

* restore avatar size fallback

* fix fallback guard

* fix fallback guard

* fix to slider

* address gemini review issues

* fix avatarSize

* update avatarSize

* address review: destructure avatarSize

* restore direct avatarSize access

* destructure avatarSize

* Apply suggestion from @gemini-code-assist[bot]

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Apply suggestion from @gemini-code-assist[bot]

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Apply suggestion from @gemini-code-assist[bot]

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-02-20 16:06:46 -05:00

56 lines
1.8 KiB
TypeScript

/*
* Vencord, a Discord client mod
* Copyright (c) 2026 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import "./styles.css";
import { definePluginSettings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
import { classNameFactory } from "@utils/css";
import definePlugin, { OptionType } from "@utils/types";
import { React } from "@webpack/common";
import { PresetManager } from "./components/presetManager";
import { loadPresets, PresetSection } from "./utils/storage";
export const cl = classNameFactory("vc-profile-presets-");
export const settings = definePluginSettings({
avatarSize: {
type: OptionType.SLIDER,
description: "Avatar size in preset list.",
markers: [56, 64, 72, 80, 88, 96],
default: 56,
stickToMarkers: true
},
});
export default definePlugin({
name: "ProfileSets",
description: "Allows you to save and load different profile presets, via the Profile Section in Settings.",
authors: [EquicordDevs.omaw, EquicordDevs.justjxke],
settings,
patches: [
{
find: "DefaultCustomizationSections: user cannot be undefined",
replacement: {
match: /return.{0,50}children:\[(?<=\.getLegacyUsername\(\).*?)/,
replace: "$&$self.renderPresetSection(\"main\"),"
}
},
{
find: "USER_SETTINGS_GUILD_PROFILE)",
replacement: {
match: /guildId:(\i\.id),onChange:(\i)\}\)(?=.{0,25}profilePreviewTitle:)/,
replace: 'guildId:$1,onChange:$2}),$self.renderPresetSection("server",$1)'
}
}
],
start() {
loadPresets("main");
},
renderPresetSection(section: PresetSection, guildId?: string) {
return <PresetManager section={section} guildId={guildId} />;
}
});