diff --git a/packages/discord-types/src/stores/MediaEngineStore.d.ts b/packages/discord-types/src/stores/MediaEngineStore.d.ts new file mode 100644 index 000000000..2452a6056 --- /dev/null +++ b/packages/discord-types/src/stores/MediaEngineStore.d.ts @@ -0,0 +1,15 @@ +import { FluxStore } from ".."; + +export class MediaEngineStore extends FluxStore { + isSelfMute(): boolean; + isSelfDeaf(): boolean; + + setAv1Enabled(AV1: boolean): void; + setH265Enabled(H265: boolean): void; + setH264Enabled(H264: boolean): void; + + getAutomaticGainControl(): boolean; + getInputDeviceId(): string; + getMediaEngine(): any; + getCodecCapabilities(e: any): any; +} diff --git a/packages/discord-types/src/stores/SpellCheckStore.d.ts b/packages/discord-types/src/stores/SpellCheckStore.d.ts new file mode 100644 index 000000000..ff3148e24 --- /dev/null +++ b/packages/discord-types/src/stores/SpellCheckStore.d.ts @@ -0,0 +1,5 @@ +import { FluxStore } from ".."; + +export class SpellCheckStore extends FluxStore { + isEnabled(): boolean; +} diff --git a/packages/discord-types/src/stores/StreamerModeStore.d.ts b/packages/discord-types/src/stores/StreamerModeStore.d.ts new file mode 100644 index 000000000..5585b4aba --- /dev/null +++ b/packages/discord-types/src/stores/StreamerModeStore.d.ts @@ -0,0 +1,6 @@ +import { FluxStore } from ".."; + +export class StreamerModeStore extends FluxStore { + enabled: boolean; + autoToggle: boolean; +} diff --git a/packages/discord-types/src/stores/index.d.ts b/packages/discord-types/src/stores/index.d.ts index 7a435ff5d..bf7d7152b 100644 --- a/packages/discord-types/src/stores/index.d.ts +++ b/packages/discord-types/src/stores/index.d.ts @@ -9,6 +9,9 @@ export * from "./GuildRoleStore"; export * from "./GuildStore"; export * from "./MessageStore"; export * from "./RelationshipStore"; +export * from "./MediaEngineStore"; +export * from "./StreamerModeStore"; +export * from "./SpellCheckStore"; export * from "./SelectedChannelStore"; export * from "./SelectedGuildStore"; export * from "./StickersStore"; diff --git a/src/api/MemberListDecorators.tsx b/src/api/MemberListDecorators.tsx index 2367e4cf7..74f16800b 100644 --- a/src/api/MemberListDecorators.tsx +++ b/src/api/MemberListDecorators.tsx @@ -20,14 +20,14 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Channel, User } from "@vencord/discord-types"; import { JSX } from "react"; -interface DecoratorProps { +export type DecoratorProps = { type: "guild" | "dm"; user: User; /** only present when this is a DM list item */ channel: Channel; /** only present when this is a guild list item */ isOwner: boolean; -} +}; export type MemberListDecoratorFactory = (props: DecoratorProps) => JSX.Element | null; type OnlyIn = "guilds" | "dms"; diff --git a/src/equicordplugins/hideServers/HiddenServersStore.ts b/src/equicordplugins/hideServers/HiddenServersStore.ts index 65e52abad..7bf946c53 100644 --- a/src/equicordplugins/hideServers/HiddenServersStore.ts +++ b/src/equicordplugins/hideServers/HiddenServersStore.ts @@ -17,7 +17,7 @@ export const HiddenServersStore = proxyLazyWebpack(() => { const DB_KEY = "HideServers_servers"; class HiddenServersStore extends Store { - private _hiddenGuilds: Set = new Set(); + public _hiddenGuilds: Set = new Set(); public get hiddenGuilds() { return this._hiddenGuilds; } diff --git a/src/equicordplugins/holyNotes/NoteHandler.ts b/src/equicordplugins/holyNotes/NoteHandler.ts index a501b9852..ff929f81d 100644 --- a/src/equicordplugins/holyNotes/NoteHandler.ts +++ b/src/equicordplugins/holyNotes/NoteHandler.ts @@ -14,7 +14,7 @@ import { deleteCacheFromDataStore, DeleteEntireStore, saveCacheToDataStore } fro export const noteHandlerCache = new Map(); export default new (class NoteHandler { - private _formatNote(channel: Channel, message: Message): HolyNotes.Note { + public _formatNote(channel: Channel, message: Message): HolyNotes.Note { return { id: message.id, channel_id: message.channel_id, diff --git a/src/equicordplugins/randomVoice/index.tsx b/src/equicordplugins/randomVoice/index.tsx index 20a23d813..63977609e 100644 --- a/src/equicordplugins/randomVoice/index.tsx +++ b/src/equicordplugins/randomVoice/index.tsx @@ -10,17 +10,15 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { debounce } from "@shared/debounce"; import { EquicordDevs } from "@utils/constants"; import definePlugin, { makeRange, OptionType } from "@utils/types"; -import { findByCode, findByProps, findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack"; -import { ChannelRouter, ChannelStore, ContextMenuApi, GuildStore, Menu, PermissionsBits, PermissionStore, React, SelectedChannelStore, Toasts, UserStore, VoiceStateStore } from "@webpack/common"; +import { findByCode, findByProps, findByPropsLazy, findComponentByCodeLazy } from "@webpack"; +import { ChannelRouter, ChannelStore, ContextMenuApi, GuildStore, MediaEngineStore, Menu, PermissionsBits, PermissionStore, React, SelectedChannelStore, Toasts, UserStore, VoiceActions, VoiceStateStore } from "@webpack/common"; import style from "./styles.css?managed"; const ChatVoiceIcon = findComponentByCodeLazy("0l1.8-1.8c.17"); const Button = findComponentByCodeLazy(".NONE,disabled:", ".PANEL_BUTTON"); -const MediaEngineStore = findStoreLazy("MediaEngineStore"); const ChannelActions = findByPropsLazy("selectChannel", "selectVoiceChannel"); -const { toggleSelfMute } = findByPropsLazy("toggleSelfMute"); -const { toggleSelfDeaf } = findByPropsLazy("toggleSelfDeaf"); + const valueOperation = [ { label: "More than", value: "<", default: false }, { label: "Less than", value: ">", default: false }, @@ -767,8 +765,8 @@ function JoinVc(channelID) { if (settings.store.autoNavigate) ChannelRouter.transitionToChannel(channel.id); if (settings.store.autoCamera && PermissionStore.can(VIDEO, channel)) autoCamera(); if (settings.store.autoStream && PermissionStore.can(STREAM, channel)) autoStream(); - if (settings.store.selfMute && !MediaEngineStore.isSelfMute() && SelectedChannelStore.getVoiceChannelId()) toggleSelfMute(); - if (settings.store.selfDeafen && !MediaEngineStore.isSelfDeaf() && SelectedChannelStore.getVoiceChannelId()) toggleSelfDeaf(); + if (settings.store.selfMute && !MediaEngineStore.isSelfMute() && SelectedChannelStore.getVoiceChannelId()) VoiceActions.toggleSelfMute(); + if (settings.store.selfDeafen && !MediaEngineStore.isSelfDeaf() && SelectedChannelStore.getVoiceChannelId()) VoiceActions.toggleSelfDeaf(); } async function autoStream() { diff --git a/src/equicordplugins/remix/editor/components/SettingColorComponent.tsx b/src/equicordplugins/remix/editor/components/SettingColorComponent.tsx index f768d9ce9..85b28416b 100644 --- a/src/equicordplugins/remix/editor/components/SettingColorComponent.tsx +++ b/src/equicordplugins/remix/editor/components/SettingColorComponent.tsx @@ -12,12 +12,6 @@ import "./colorStyles.css"; import { classNameFactory } from "@api/Styles"; import { ColorPicker, Forms } from "@webpack/common"; -interface ColorPickerProps { - color: number | null; - showEyeDropper?: boolean; - onChange(value: number | null): void; -} - const cl = classNameFactory("vc-remix-settings-color-"); interface Props { diff --git a/src/equicordplugins/streamingCodecDisabler/index.ts b/src/equicordplugins/streamingCodecDisabler/index.ts index f26113e9c..ed05ae14e 100644 --- a/src/equicordplugins/streamingCodecDisabler/index.ts +++ b/src/equicordplugins/streamingCodecDisabler/index.ts @@ -7,9 +7,9 @@ import { definePluginSettings, Settings } from "@api/Settings"; import { EquicordDevs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { findStoreLazy } from "@webpack"; +import { MediaEngineStore } from "@webpack/common"; -let mediaEngine = findStoreLazy("MediaEngineStore"); +let mediaEngine = MediaEngineStore; const originalCodecStatuses: { AV1: boolean, diff --git a/src/equicordplugins/toastNotifications/index.tsx b/src/equicordplugins/toastNotifications/index.tsx index 6a22ecf0c..b6433cdf3 100644 --- a/src/equicordplugins/toastNotifications/index.tsx +++ b/src/equicordplugins/toastNotifications/index.tsx @@ -21,7 +21,7 @@ import { EquicordDevs } from "@utils/constants"; import definePlugin, { makeRange, OptionType } from "@utils/types"; import { Channel, Message, User } from "@vencord/discord-types"; import { findByPropsLazy, findStore } from "@webpack"; -import { Button, ChannelStore, GuildRoleStore, NavigationRouter, RelationshipStore, SelectedChannelStore, UserStore } from "@webpack/common"; +import { Button, ChannelStore, GuildRoleStore, NavigationRouter, RelationshipStore, SelectedChannelStore, StreamerModeStore, UserStore } from "@webpack/common"; import { ReactNode } from "react"; import { NotificationData, showNotification } from "./components/Notifications"; @@ -219,7 +219,7 @@ export default definePlugin({ const isStreaming = findStore("ApplicationStreamingStore").getAnyStreamForUser(UserStore.getCurrentUser()?.id); const streamerMode = settings.store.disableInStreamerMode; - const currentUserStreamerMode = findStore("StreamerModeStore").enabled; + const currentUserStreamerMode = StreamerModeStore.enabled; if (streamerMode && currentUserStreamerMode) return; if (isStreaming && settings.store.streamingTreatment === StreamingTreatment.IGNORE) return; diff --git a/src/equicordplugins/youtubeMusicControls/YtmStore.ts b/src/equicordplugins/youtubeMusicControls/YtmStore.ts index 66e6822eb..ee6ff1388 100644 --- a/src/equicordplugins/youtubeMusicControls/YtmStore.ts +++ b/src/equicordplugins/youtubeMusicControls/YtmStore.ts @@ -63,7 +63,7 @@ class YoutubeMusicSocket { public onChange: (e: Message) => void; public ready = false; - private socket: WebSocket | undefined; + public socket: WebSocket | undefined; constructor(onChange: typeof this.onChange) { this.reconnect(); @@ -146,7 +146,7 @@ export const YoutubeMusicStore = proxyLazyWebpack(() => { class YoutubeMusicStore extends Store { public mPosition = 0; - private start = 0; + public start = 0; public song: Song | null = null; public isPlaying = false; @@ -226,7 +226,7 @@ export const YoutubeMusicStore = proxyLazyWebpack(() => { this.socket.routes.seek(Math.round(ms / 1000)); } - private ensureSocketReady(): boolean { + public ensureSocketReady(): boolean { if (!this.socket || !this.socket.ready) { return false; } diff --git a/src/plugins/showMeYourName/index.tsx b/src/plugins/showMeYourName/index.tsx index f9086459e..f3ec4ae0a 100644 --- a/src/plugins/showMeYourName/index.tsx +++ b/src/plugins/showMeYourName/index.tsx @@ -11,11 +11,10 @@ import { Devs, EquicordDevs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { GuildMember, Message, User } from "@vencord/discord-types"; import { findByCodeLazy, findStoreLazy } from "@webpack"; -import { ChannelStore, GuildMemberStore, MessageStore, RelationshipStore, UserStore } from "@webpack/common"; +import { ChannelStore, GuildMemberStore, MessageStore, RelationshipStore, StreamerModeStore, UserStore } from "@webpack/common"; import { JSX } from "react"; const wrapEmojis = findByCodeLazy(/"span",\{className:\i\.emoji,children:/); -const StreamerModeStore = findStoreLazy("StreamerModeStore"); const AccessibilityStore = findStoreLazy("AccessibilityStore"); const colorPattern = /^#(?:[\da-f]{3}){1,2}$|^#(?:[\da-f]{4}){1,2}$|(rgb|hsl)a?\((\s*-?\d+%?\s*,){2}(\s*-?\d+%?\s*)\)|(rgb|hsl)a?\((\s*-?\d+%?\s*,){3}\s*(0|(0?\.\d+)|1)\)$/iu; const roleColorPattern = /^role((?:\+|-)\d{0,4})?$/iu; diff --git a/src/plugins/userVoiceShow/components.tsx b/src/plugins/userVoiceShow/components.tsx index 8edd1303a..a9f4311cc 100644 --- a/src/plugins/userVoiceShow/components.tsx +++ b/src/plugins/userVoiceShow/components.tsx @@ -156,13 +156,13 @@ function VoiceChannelTooltip({ channel, isLocked }: VoiceChannelTooltipProps) { ); } -interface VoiceChannelIndicatorProps { +export type VoiceChannelIndicatorProps = { userId: string; isMessageIndicator?: boolean; isProfile?: boolean; isActionButton?: boolean; shouldHighlight?: boolean; -} +}; const clickTimers = {} as Record; diff --git a/src/plugins/voiceMessages/DesktopRecorder.tsx b/src/plugins/voiceMessages/DesktopRecorder.tsx index 18581ad16..8b6bc6d06 100644 --- a/src/plugins/voiceMessages/DesktopRecorder.tsx +++ b/src/plugins/voiceMessages/DesktopRecorder.tsx @@ -17,11 +17,10 @@ */ import { PluginNative } from "@utils/types"; -import { Button, showToast, Toasts, useState } from "@webpack/common"; +import { Button, MediaEngineStore, showToast, Toasts, useState } from "@webpack/common"; import type { VoiceRecorder } from "."; import { settings } from "./settings"; -import { MediaEngineStore } from "./utils"; const Native = VencordNative.pluginHelpers.VoiceMessages as PluginNative; diff --git a/src/plugins/voiceMessages/WebRecorder.tsx b/src/plugins/voiceMessages/WebRecorder.tsx index eb77b1990..8bac28a2d 100644 --- a/src/plugins/voiceMessages/WebRecorder.tsx +++ b/src/plugins/voiceMessages/WebRecorder.tsx @@ -16,11 +16,10 @@ * along with this program. If not, see . */ -import { Button, useState } from "@webpack/common"; +import { Button, MediaEngineStore, useState } from "@webpack/common"; import type { VoiceRecorder } from "."; import { settings } from "./settings"; -import { MediaEngineStore } from "./utils"; export const VoiceRecorderWeb: VoiceRecorder = ({ setAudioBlob, onRecordingChange }) => { const [recording, setRecording] = useState(false); diff --git a/src/plugins/voiceMessages/utils.ts b/src/plugins/voiceMessages/utils.ts index ef571bbf3..dcfd6f26c 100644 --- a/src/plugins/voiceMessages/utils.ts +++ b/src/plugins/voiceMessages/utils.ts @@ -17,7 +17,5 @@ */ import { classNameFactory } from "@api/Styles"; -import { findStoreLazy } from "@webpack"; -export const MediaEngineStore = findStoreLazy("MediaEngineStore"); export const cl = classNameFactory("vc-vmsg-"); diff --git a/src/webpack/common/stores.ts b/src/webpack/common/stores.ts index a7a96169a..1436ce149 100644 --- a/src/webpack/common/stores.ts +++ b/src/webpack/common/stores.ts @@ -48,6 +48,9 @@ export let SelectedGuildStore: t.SelectedGuildStore; export let ChannelStore: t.ChannelStore; export let TypingStore: t.TypingStore; export let RelationshipStore: t.RelationshipStore; +export let MediaEngineStore: t.MediaEngineStore; +export let StreamerModeStore: t.StreamerModeStore; +export let SpellCheckStore: t.SpellCheckStore; export let EmojiStore: t.EmojiStore; export let StickersStore: t.StickersStore; @@ -71,6 +74,9 @@ waitForStore("GuildStore", m => GuildStore = m); waitForStore("GuildRoleStore", m => GuildRoleStore = m); waitForStore("GuildMemberStore", m => GuildMemberStore = m); waitForStore("RelationshipStore", m => RelationshipStore = m); +waitForStore("MediaEngineStore", m => MediaEngineStore = m); +waitForStore("StreamerModeStore", m => StreamerModeStore = m); +waitForStore("SpellCheckStore", m => SpellCheckStore = m); waitForStore("PermissionStore", m => PermissionStore = m); waitForStore("PresenceStore", m => PresenceStore = m); waitForStore("ReadStateStore", m => ReadStateStore = m); diff --git a/src/webpack/common/utils.ts b/src/webpack/common/utils.ts index ca362628f..c106a107c 100644 --- a/src/webpack/common/utils.ts +++ b/src/webpack/common/utils.ts @@ -179,6 +179,8 @@ export const UserProfileActions = findByPropsLazy("openUserProfileModal", "close export const InviteActions = findByPropsLazy("resolveInvite"); export const ChannelActionCreators = findByPropsLazy("openPrivateChannel"); +export const VoiceActions = findByPropsLazy("toggleSelfMute"); + export const IconUtils: t.IconUtils = findByPropsLazy("getGuildBannerURL", "getUserAvatarURL"); export const ReadStateUtils = mapMangledModuleLazy('type:"ENABLE_AUTOMATIC_ACK",', {