Fix VoiceMessages
This commit is contained in:
parent
8ac8048845
commit
25dc25c707
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { LazyComponent, useTimer } from "@utils/react";
|
import { LazyComponent, useTimer } from "@utils/react";
|
||||||
import { findByCode } from "@webpack";
|
import { find } from "@webpack";
|
||||||
|
|
||||||
import { cl } from "./utils";
|
import { cl } from "./utils";
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ interface VoiceMessageProps {
|
||||||
src: string;
|
src: string;
|
||||||
waveform: string;
|
waveform: string;
|
||||||
}
|
}
|
||||||
const VoiceMessage = LazyComponent<VoiceMessageProps>(() => findByCode('["onVolumeChange","volume","onMute"]'));
|
const VoiceMessage = LazyComponent<VoiceMessageProps>(() => find(m => m.type?.toString().includes("waveform:")));
|
||||||
|
|
||||||
export type VoicePreviewOptions = {
|
export type VoicePreviewOptions = {
|
||||||
src?: string;
|
src?: string;
|
||||||
|
|
|
@ -25,7 +25,7 @@ import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModa
|
||||||
import { useAwaiter } from "@utils/react";
|
import { useAwaiter } from "@utils/react";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { chooseFile } from "@utils/web";
|
import { chooseFile } from "@utils/web";
|
||||||
import { findByPropsLazy, findLazy, findStoreLazy } from "@webpack";
|
import { findByPropsLazy, findStoreLazy } from "@webpack";
|
||||||
import { Button, FluxDispatcher, Forms, lodash, Menu, PermissionsBits, PermissionStore, RestAPI, SelectedChannelStore, showToast, SnowflakeUtils, Toasts, useEffect, useState } from "@webpack/common";
|
import { Button, FluxDispatcher, Forms, lodash, Menu, PermissionsBits, PermissionStore, RestAPI, SelectedChannelStore, showToast, SnowflakeUtils, Toasts, useEffect, useState } from "@webpack/common";
|
||||||
import { ComponentType } from "react";
|
import { ComponentType } from "react";
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ import { cl } from "./utils";
|
||||||
import { VoicePreview } from "./VoicePreview";
|
import { VoicePreview } from "./VoicePreview";
|
||||||
import { VoiceRecorderWeb } from "./WebRecorder";
|
import { VoiceRecorderWeb } from "./WebRecorder";
|
||||||
|
|
||||||
const CloudUpload = findLazy(m => m.prototype?.uploadFileToCloud);
|
const CloudUtils = findByPropsLazy("CloudUpload");
|
||||||
const MessageCreator = findByPropsLazy("getSendMessageOptionsForReply", "sendMessage");
|
const MessageCreator = findByPropsLazy("getSendMessageOptionsForReply", "sendMessage");
|
||||||
const PendingReplyStore = findStoreLazy("PendingReplyStore");
|
const PendingReplyStore = findStoreLazy("PendingReplyStore");
|
||||||
const OptionClasses = findByPropsLazy("optionName", "optionIcon", "optionLabel");
|
const OptionClasses = findByPropsLazy("optionName", "optionIcon", "optionLabel");
|
||||||
|
@ -76,7 +76,7 @@ function sendAudio(blob: Blob, meta: AudioMetadata) {
|
||||||
const reply = PendingReplyStore.getPendingReply(channelId);
|
const reply = PendingReplyStore.getPendingReply(channelId);
|
||||||
if (reply) FluxDispatcher.dispatch({ type: "DELETE_PENDING_REPLY", channelId });
|
if (reply) FluxDispatcher.dispatch({ type: "DELETE_PENDING_REPLY", channelId });
|
||||||
|
|
||||||
const upload = new CloudUpload({
|
const upload = new CloudUtils.CloudUpload({
|
||||||
file: new File([blob], "voice-message.ogg", { type: "audio/ogg; codecs=opus" }),
|
file: new File([blob], "voice-message.ogg", { type: "audio/ogg; codecs=opus" }),
|
||||||
isClip: false,
|
isClip: false,
|
||||||
isThumbnail: false,
|
isThumbnail: false,
|
||||||
|
|
Loading…
Reference in a new issue