mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-26 17:26:22 +00:00
Merge branch 'dev' into newDevTools
This commit is contained in:
commit
5cdfb576f9
15 changed files with 125 additions and 59 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "vencord",
|
"name": "vencord",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"version": "1.9.7",
|
"version": "1.9.8",
|
||||||
"description": "The cutest Discord client mod",
|
"description": "The cutest Discord client mod",
|
||||||
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|
|
@ -230,6 +230,10 @@ export function definePluginSettings<
|
||||||
if (!definedSettings.pluginName) throw new Error("Cannot access settings before plugin is initialized");
|
if (!definedSettings.pluginName) throw new Error("Cannot access settings before plugin is initialized");
|
||||||
return Settings.plugins[definedSettings.pluginName] as any;
|
return Settings.plugins[definedSettings.pluginName] as any;
|
||||||
},
|
},
|
||||||
|
get plain() {
|
||||||
|
if (!definedSettings.pluginName) throw new Error("Cannot access settings before plugin is initialized");
|
||||||
|
return PlainSettings.plugins[definedSettings.pluginName] as any;
|
||||||
|
},
|
||||||
use: settings => useSettings(
|
use: settings => useSettings(
|
||||||
settings?.map(name => `plugins.${definedSettings.pluginName}.${name}`) as UseSettings<Settings>[]
|
settings?.map(name => `plugins.${definedSettings.pluginName}.${name}`) as UseSettings<Settings>[]
|
||||||
).plugins[definedSettings.pluginName] as any,
|
).plugins[definedSettings.pluginName] as any,
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getCurrentChannel } from "@utils/discord";
|
import { getCurrentChannel } from "@utils/discord";
|
||||||
|
import { isObjectEmpty } from "@utils/misc";
|
||||||
import { SelectedChannelStore, Tooltip, useEffect, useStateFromStores } from "@webpack/common";
|
import { SelectedChannelStore, Tooltip, useEffect, useStateFromStores } from "@webpack/common";
|
||||||
|
|
||||||
import { ChannelMemberStore, cl, GuildMemberCountStore, numberFormat } from ".";
|
import { ChannelMemberStore, cl, GuildMemberCountStore, numberFormat, ThreadMemberListStore } from ".";
|
||||||
import { OnlineMemberCountStore } from "./OnlineMemberCountStore";
|
import { OnlineMemberCountStore } from "./OnlineMemberCountStore";
|
||||||
|
|
||||||
export function MemberCount({ isTooltip, tooltipGuildId }: { isTooltip?: true; tooltipGuildId?: string; }) {
|
export function MemberCount({ isTooltip, tooltipGuildId }: { isTooltip?: true; tooltipGuildId?: string; }) {
|
||||||
|
@ -30,10 +31,19 @@ export function MemberCount({ isTooltip, tooltipGuildId }: { isTooltip?: true; t
|
||||||
() => ChannelMemberStore.getProps(guildId, currentChannel?.id)
|
() => ChannelMemberStore.getProps(guildId, currentChannel?.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const threadGroups = useStateFromStores(
|
||||||
|
[ThreadMemberListStore],
|
||||||
|
() => ThreadMemberListStore.getMemberListSections(currentChannel.id)
|
||||||
|
);
|
||||||
|
|
||||||
if (!isTooltip && (groups.length >= 1 || groups[0].id !== "unknown")) {
|
if (!isTooltip && (groups.length >= 1 || groups[0].id !== "unknown")) {
|
||||||
onlineCount = groups.reduce((total, curr) => total + (curr.id === "offline" ? 0 : curr.count), 0);
|
onlineCount = groups.reduce((total, curr) => total + (curr.id === "offline" ? 0 : curr.count), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isTooltip && threadGroups && !isObjectEmpty(threadGroups)) {
|
||||||
|
onlineCount = Object.values(threadGroups).reduce((total, curr) => total + (curr.sectionId === "offline" ? 0 : curr.userIds.length), 0);
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
OnlineMemberCountStore.ensureCount(guildId);
|
OnlineMemberCountStore.ensureCount(guildId);
|
||||||
}, [guildId]);
|
}, [guildId]);
|
||||||
|
|
|
@ -32,6 +32,10 @@ export const GuildMemberCountStore = findStoreLazy("GuildMemberCountStore") as F
|
||||||
export const ChannelMemberStore = findStoreLazy("ChannelMemberStore") as FluxStore & {
|
export const ChannelMemberStore = findStoreLazy("ChannelMemberStore") as FluxStore & {
|
||||||
getProps(guildId: string, channelId: string): { groups: { count: number; id: string; }[]; };
|
getProps(guildId: string, channelId: string): { groups: { count: number; id: string; }[]; };
|
||||||
};
|
};
|
||||||
|
export const ThreadMemberListStore = findStoreLazy("ThreadMemberListStore") as FluxStore & {
|
||||||
|
getMemberListSections(channelId: string): { [sectionId: string]: { sectionId: string; userIds: string[]; }; };
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
toolTip: {
|
toolTip: {
|
||||||
|
|
|
@ -22,7 +22,7 @@ import { Devs } from "@utils/constants";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCodeLazy, findLazy } from "@webpack";
|
import { findByCodeLazy, findLazy } from "@webpack";
|
||||||
import { Card, ChannelStore, Forms, GuildStore, PermissionsBits, Switch, TextInput, Tooltip, useState } from "@webpack/common";
|
import { Card, ChannelStore, Forms, GuildStore, PermissionsBits, Switch, TextInput, Tooltip } from "@webpack/common";
|
||||||
import type { Permissions, RC } from "@webpack/types";
|
import type { Permissions, RC } from "@webpack/types";
|
||||||
import type { Channel, Guild, Message, User } from "discord-types/general";
|
import type { Channel, Guild, Message, User } from "discord-types/general";
|
||||||
|
|
||||||
|
@ -107,14 +107,8 @@ const defaultSettings = Object.fromEntries(
|
||||||
tags.map(({ name, displayName }) => [name, { text: displayName, showInChat: true, showInNotChat: true }])
|
tags.map(({ name, displayName }) => [name, { text: displayName, showInChat: true, showInNotChat: true }])
|
||||||
) as TagSettings;
|
) as TagSettings;
|
||||||
|
|
||||||
function SettingsComponent(props: { setValue(v: any): void; }) {
|
function SettingsComponent() {
|
||||||
settings.store.tagSettings ??= defaultSettings;
|
const tagSettings = settings.store.tagSettings ??= defaultSettings;
|
||||||
|
|
||||||
const [tagSettings, setTagSettings] = useState(settings.store.tagSettings as TagSettings);
|
|
||||||
const setValue = (v: TagSettings) => {
|
|
||||||
setTagSettings(v);
|
|
||||||
props.setValue(v);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex flexDirection="column">
|
<Flex flexDirection="column">
|
||||||
|
@ -137,19 +131,13 @@ function SettingsComponent(props: { setValue(v: any): void; }) {
|
||||||
type="text"
|
type="text"
|
||||||
value={tagSettings[t.name]?.text ?? t.displayName}
|
value={tagSettings[t.name]?.text ?? t.displayName}
|
||||||
placeholder={`Text on tag (default: ${t.displayName})`}
|
placeholder={`Text on tag (default: ${t.displayName})`}
|
||||||
onChange={v => {
|
onChange={v => tagSettings[t.name].text = v}
|
||||||
tagSettings[t.name].text = v;
|
|
||||||
setValue(tagSettings);
|
|
||||||
}}
|
|
||||||
className={Margins.bottom16}
|
className={Margins.bottom16}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
value={tagSettings[t.name]?.showInChat ?? true}
|
value={tagSettings[t.name]?.showInChat ?? true}
|
||||||
onChange={v => {
|
onChange={v => tagSettings[t.name].showInChat = v}
|
||||||
tagSettings[t.name].showInChat = v;
|
|
||||||
setValue(tagSettings);
|
|
||||||
}}
|
|
||||||
hideBorder
|
hideBorder
|
||||||
>
|
>
|
||||||
Show in messages
|
Show in messages
|
||||||
|
@ -157,10 +145,7 @@ function SettingsComponent(props: { setValue(v: any): void; }) {
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
value={tagSettings[t.name]?.showInNotChat ?? true}
|
value={tagSettings[t.name]?.showInNotChat ?? true}
|
||||||
onChange={v => {
|
onChange={v => tagSettings[t.name].showInNotChat = v}
|
||||||
tagSettings[t.name].showInNotChat = v;
|
|
||||||
setValue(tagSettings);
|
|
||||||
}}
|
|
||||||
hideBorder
|
hideBorder
|
||||||
>
|
>
|
||||||
Show in member list and profiles
|
Show in member list and profiles
|
||||||
|
@ -183,7 +168,7 @@ const settings = definePluginSettings({
|
||||||
tagSettings: {
|
tagSettings: {
|
||||||
type: OptionType.COMPONENT,
|
type: OptionType.COMPONENT,
|
||||||
component: SettingsComponent,
|
component: SettingsComponent,
|
||||||
description: "fill me",
|
description: "fill me"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
3
src/plugins/noMaskedUrlPaste/README.md
Normal file
3
src/plugins/noMaskedUrlPaste/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# NoMaskedUrlPaste
|
||||||
|
|
||||||
|
Pasting a link while you have text selected will NOT paste your link as a masked link.
|
23
src/plugins/noMaskedUrlPaste/index.ts
Normal file
23
src/plugins/noMaskedUrlPaste/index.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2023 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Devs } from "@utils/constants.js";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "NoMaskedUrlPaste",
|
||||||
|
authors: [Devs.CatNoir],
|
||||||
|
description: "Pasting a link while having text selected will not paste as masked URL",
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: ".selection,preventEmojiSurrogates:",
|
||||||
|
replacement: {
|
||||||
|
match: /if\(null!=\i.selection&&\i.\i.isExpanded\(\i.selection\)\)/,
|
||||||
|
replace: "if(false)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
});
|
|
@ -19,7 +19,6 @@
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { UserStore } from "@webpack/common";
|
import { UserStore } from "@webpack/common";
|
||||||
import virtualMerge from "virtual-merge";
|
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "NoProfileThemes",
|
name: "NoProfileThemes",
|
||||||
|
@ -33,21 +32,7 @@ export default definePlugin({
|
||||||
replace: "$&$self.isCurrentUser(this.userId)&&"
|
replace: "$&$self.isCurrentUser(this.userId)&&"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
find: "UserProfileStore",
|
|
||||||
replacement: {
|
|
||||||
match: /(?<=getUserProfile\(\i\){return )(.+?)(?=})/,
|
|
||||||
replace: "$self.removeProfileThemes($1)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
|
|
||||||
isCurrentUser: (userId: string) => userId === UserStore.getCurrentUser()?.id,
|
isCurrentUser: (userId: string) => userId === UserStore.getCurrentUser()?.id,
|
||||||
removeProfileThemes: (displayProfile: any) => {
|
|
||||||
if (displayProfile == null) return displayProfile;
|
|
||||||
|
|
||||||
return displayProfile.userId === UserStore.getCurrentUser()?.id
|
|
||||||
? displayProfile
|
|
||||||
: virtualMerge(displayProfile, { banner: undefined, profileEffectId: undefined });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,11 +26,6 @@ import { CompactPronounsChatComponentWrapper, PronounsChatComponentWrapper } fro
|
||||||
import { useProfilePronouns } from "./pronoundbUtils";
|
import { useProfilePronouns } from "./pronoundbUtils";
|
||||||
import { settings } from "./settings";
|
import { settings } from "./settings";
|
||||||
|
|
||||||
const PRONOUN_TOOLTIP_PATCH = {
|
|
||||||
match: /text:(.{0,10}.Messages\.USER_PROFILE_PRONOUNS)(?=,)/,
|
|
||||||
replace: '$& + (typeof vcPronounSource !== "undefined" ? ` (${vcPronounSource})` : "")'
|
|
||||||
};
|
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "PronounDB",
|
name: "PronounDB",
|
||||||
authors: [Devs.Tyman, Devs.TheKodeToad, Devs.Ven, Devs.Elvyra],
|
authors: [Devs.Tyman, Devs.TheKodeToad, Devs.Ven, Devs.Elvyra],
|
||||||
|
@ -52,7 +47,24 @@ export default definePlugin({
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
// @TODO Patch discord pronoun hook in user profiles (useProfilePronouns)
|
{
|
||||||
|
find: ".Messages.USER_PROFILE_PRONOUNS",
|
||||||
|
group: true,
|
||||||
|
replacement: [
|
||||||
|
{
|
||||||
|
match: /\.PANEL},/,
|
||||||
|
replace: "$&[vcPronoun,vcPronounSource,vcHasPendingPronouns]=$self.useProfilePronouns(arguments[0].user?.id),"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /text:\i\.\i.Messages.USER_PROFILE_PRONOUNS/,
|
||||||
|
replace: '$&+vcHasPendingPronouns?"":` (${vcPronounSource})`'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /(\.pronounsText.+?children:)(\i)/,
|
||||||
|
replace: "$1vcHasPendingPronouns?$2:vcPronoun"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
settings,
|
settings,
|
||||||
|
|
|
@ -21,13 +21,16 @@ import { debounce } from "@shared/debounce";
|
||||||
import { VENCORD_USER_AGENT } from "@shared/vencordUserAgent";
|
import { VENCORD_USER_AGENT } from "@shared/vencordUserAgent";
|
||||||
import { getCurrentChannel } from "@utils/discord";
|
import { getCurrentChannel } from "@utils/discord";
|
||||||
import { useAwaiter } from "@utils/react";
|
import { useAwaiter } from "@utils/react";
|
||||||
|
import { findStoreLazy } from "@webpack";
|
||||||
import { UserProfileStore, UserStore } from "@webpack/common";
|
import { UserProfileStore, UserStore } from "@webpack/common";
|
||||||
|
|
||||||
import { settings } from "./settings";
|
import { settings } from "./settings";
|
||||||
import { CachePronouns, PronounCode, PronounMapping, PronounsResponse } from "./types";
|
import { CachePronouns, PronounCode, PronounMapping, PronounsResponse } from "./types";
|
||||||
|
|
||||||
type PronounsWithSource = [string | null, string];
|
const UserSettingsAccountStore = findStoreLazy("UserSettingsAccountStore");
|
||||||
const EmptyPronouns: PronounsWithSource = [null, ""];
|
|
||||||
|
type PronounsWithSource = [pronouns: string | null, source: string, hasPendingPronouns: boolean];
|
||||||
|
const EmptyPronouns: PronounsWithSource = [null, "", false];
|
||||||
|
|
||||||
export const enum PronounsFormat {
|
export const enum PronounsFormat {
|
||||||
Lowercase = "LOWERCASE",
|
Lowercase = "LOWERCASE",
|
||||||
|
@ -75,13 +78,15 @@ export function useFormattedPronouns(id: string, useGlobalProfile: boolean = fal
|
||||||
onError: e => console.error("Fetching pronouns failed: ", e)
|
onError: e => console.error("Fetching pronouns failed: ", e)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const hasPendingPronouns = UserSettingsAccountStore.getPendingPronouns() != null;
|
||||||
|
|
||||||
if (settings.store.pronounSource === PronounSource.PreferDiscord && discordPronouns)
|
if (settings.store.pronounSource === PronounSource.PreferDiscord && discordPronouns)
|
||||||
return [discordPronouns, "Discord"];
|
return [discordPronouns, "Discord", hasPendingPronouns];
|
||||||
|
|
||||||
if (result && result !== PronounMapping.unspecified)
|
if (result && result !== PronounMapping.unspecified)
|
||||||
return [result, "PronounDB"];
|
return [result, "PronounDB", hasPendingPronouns];
|
||||||
|
|
||||||
return [discordPronouns, "Discord"];
|
return [discordPronouns, "Discord", hasPendingPronouns];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useProfilePronouns(id: string, useGlobalProfile: boolean = false): PronounsWithSource {
|
export function useProfilePronouns(id: string, useGlobalProfile: boolean = false): PronounsWithSource {
|
||||||
|
@ -147,7 +152,7 @@ async function bulkFetchPronouns(ids: string[]): Promise<PronounsResponse> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function extractPronouns(pronounSet?: { [locale: string]: PronounCode[] }): string {
|
export function extractPronouns(pronounSet?: { [locale: string]: PronounCode[]; }): string {
|
||||||
if (!pronounSet || !pronounSet.en) return PronounMapping.unspecified;
|
if (!pronounSet || !pronounSet.en) return PronounMapping.unspecified;
|
||||||
// PronounDB returns an empty set instead of {sets: {en: ["unspecified"]}}.
|
// PronounDB returns an empty set instead of {sets: {en: ["unspecified"]}}.
|
||||||
const pronouns = pronounSet.en;
|
const pronouns = pronounSet.en;
|
||||||
|
|
|
@ -79,8 +79,22 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ".BITE_SIZE,user:",
|
find: ".BITE_SIZE,user:",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=\.BITE_SIZE,children:\[)\(0,\i\.jsx\)\(\i\.\i,\{user:(\i),/,
|
match: /{profileType:\i\.\i\.BITE_SIZE,children:\[/,
|
||||||
replace: "$self.BiteSizeReviewsButton({user:$1}),$&"
|
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: ".FULL_SIZE,user:",
|
||||||
|
replacement: {
|
||||||
|
match: /{profileType:\i\.\i\.FULL_SIZE,children:\[/,
|
||||||
|
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: ".PANEL,isInteractionSource:",
|
||||||
|
replacement: {
|
||||||
|
match: /{profileType:\i\.\i\.PANEL,children:\[/,
|
||||||
|
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -168,7 +168,7 @@ export default definePlugin({
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: '"BiteSizeProfileBody"',
|
find: ".hasAvatarForGuild(null==",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /currentUser:\i,guild:\i}\)(?<=user:(\i),bio:null==(\i)\?.+?)/,
|
match: /currentUser:\i,guild:\i}\)(?<=user:(\i),bio:null==(\i)\?.+?)/,
|
||||||
replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2 })"
|
replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2 })"
|
||||||
|
|
|
@ -309,6 +309,8 @@ export interface DefinedSettings<
|
||||||
> {
|
> {
|
||||||
/** Shorthand for `Vencord.Settings.plugins.PluginName`, but with typings */
|
/** Shorthand for `Vencord.Settings.plugins.PluginName`, but with typings */
|
||||||
store: SettingsStore<Def> & PrivateSettings;
|
store: SettingsStore<Def> & PrivateSettings;
|
||||||
|
/** Shorthand for `Vencord.PlainSettings.plugins.PluginName`, but with typings */
|
||||||
|
plain: SettingsStore<Def> & PrivateSettings;
|
||||||
/**
|
/**
|
||||||
* React hook for getting the settings for this plugin
|
* React hook for getting the settings for this plugin
|
||||||
* @param filter optional filter to avoid rerenders for irrelevent settings
|
* @param filter optional filter to avoid rerenders for irrelevent settings
|
||||||
|
|
19
src/webpack/common/types/utils.d.ts
vendored
19
src/webpack/common/types/utils.d.ts
vendored
|
@ -223,9 +223,26 @@ export interface Constants {
|
||||||
FriendsSections: Record<string, string>;
|
FriendsSections: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ActiveView = LiteralUnion<"emoji" | "gif" | "sticker" | "soundboard", string>;
|
||||||
|
|
||||||
|
export interface ExpressionPickerStoreState extends Record<PropertyKey, any> {
|
||||||
|
activeView: ActiveView | null;
|
||||||
|
lastActiveView: ActiveView | null;
|
||||||
|
activeViewType: any | null;
|
||||||
|
searchQuery: string;
|
||||||
|
isSearchSuggestion: boolean,
|
||||||
|
pickerId: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ExpressionPickerStore {
|
export interface ExpressionPickerStore {
|
||||||
|
openExpressionPicker(activeView: ActiveView, activeViewType?: any): void;
|
||||||
closeExpressionPicker(activeViewType?: any): void;
|
closeExpressionPicker(activeViewType?: any): void;
|
||||||
openExpressionPicker(activeView: LiteralUnion<"emoji" | "gif" | "sticker", string>, activeViewType?: any): void;
|
toggleMultiExpressionPicker(activeViewType?: any): void;
|
||||||
|
toggleExpressionPicker(activeView: ActiveView, activeViewType?: any): void;
|
||||||
|
setExpressionPickerView(activeView: ActiveView): void;
|
||||||
|
setSearchQuery(searchQuery: string, isSearchSuggestion?: boolean): void;
|
||||||
|
useExpressionPickerStore(): ExpressionPickerStoreState;
|
||||||
|
useExpressionPickerStore<T>(selector: (state: ExpressionPickerStoreState) => T): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BrowserWindowFeatures {
|
export interface BrowserWindowFeatures {
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { canonicalizeMatch } from "@utils/patches";
|
|
||||||
import type { Channel } from "discord-types/general";
|
import type { Channel } from "discord-types/general";
|
||||||
|
|
||||||
// eslint-disable-next-line path-alias/no-relative
|
// eslint-disable-next-line path-alias/no-relative
|
||||||
|
@ -162,11 +161,14 @@ export const InviteActions = findByPropsLazy("resolveInvite");
|
||||||
|
|
||||||
export const IconUtils: t.IconUtils = findByPropsLazy("getGuildBannerURL", "getUserAvatarURL");
|
export const IconUtils: t.IconUtils = findByPropsLazy("getGuildBannerURL", "getUserAvatarURL");
|
||||||
|
|
||||||
const openExpressionPickerMatcher = canonicalizeMatch(/setState\({activeView:\i,activeViewType:/);
|
|
||||||
// TODO: type
|
|
||||||
export const ExpressionPickerStore: t.ExpressionPickerStore = mapMangledModuleLazy("expression-picker-last-active-view", {
|
export const ExpressionPickerStore: t.ExpressionPickerStore = mapMangledModuleLazy("expression-picker-last-active-view", {
|
||||||
|
openExpressionPicker: filters.byCode(/setState\({activeView:(?:(?!null)\i),activeViewType:/),
|
||||||
closeExpressionPicker: filters.byCode("setState({activeView:null"),
|
closeExpressionPicker: filters.byCode("setState({activeView:null"),
|
||||||
openExpressionPicker: m => typeof m === "function" && openExpressionPickerMatcher.test(m.toString()),
|
toggleMultiExpressionPicker: filters.byCode(".EMOJI,"),
|
||||||
|
toggleExpressionPicker: filters.byCode(/getState\(\)\.activeView===\i\?\i\(\):\i\(/),
|
||||||
|
setExpressionPickerView: filters.byCode(/setState\({activeView:\i,lastActiveView:/),
|
||||||
|
setSearchQuery: filters.byCode("searchQuery:"),
|
||||||
|
useExpressionPickerStore: filters.byCode("Object.is")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const PopoutActions: t.PopoutActions = mapMangledModuleLazy('type:"POPOUT_WINDOW_OPEN"', {
|
export const PopoutActions: t.PopoutActions = mapMangledModuleLazy('type:"POPOUT_WINDOW_OPEN"', {
|
||||||
|
|
Loading…
Reference in a new issue