Новый тип вложений - Attachment.CALL с активными звонками

This commit is contained in:
RoyceDa
2026-03-21 21:18:09 +02:00
parent 48e0cddbaa
commit e019702dbe
10 changed files with 446 additions and 113 deletions

View File

@@ -14,6 +14,7 @@ import { useProtocolState } from "../ProtocolProvider/useProtocolState";
import { ProtocolState } from "../ProtocolProvider/ProtocolProvider";
import { useGroups } from "./useGroups";
import { useConsoleLogger } from "@/app/hooks/useConsoleLogger";
import { usePrepareAttachment } from "../AttachmentProvider/usePrepareAttachment";
export function useDialog() : {
messages: Message[];
@@ -34,8 +35,7 @@ export function useDialog() : {
throw new Error("useDialog must be used within a DialogProvider");
}
const {loading,
messages,
prepareAttachmentsToSend,
messages,
clearDialogCache,
setMessages,
dialog, loadMessagesToTop, loadMessagesToMessageId} = context;
@@ -47,6 +47,7 @@ export function useDialog() : {
const [protocolState] = useProtocolState();
const {hasGroup, getGroupKey} = useGroups();
const {warn} = useConsoleLogger('useDialog');
const {prepareAttachmentsToSend} = usePrepareAttachment();
/**
* Отправка сообщения в диалог
@@ -146,7 +147,7 @@ export function useDialog() : {
//98acbbc68f4b2449daf0a39d1b3eab9a3056da5d45b811bbc903e214c21d39643394980231e1a89c811830d870f3354184319665327ca8bd
console.info("Sending key for message ", key.toString('hex'));
let preparedToNetworkSendAttachements : Attachment[] = await prepareAttachmentsToSend(key.toString('utf-8'), attachemnts);
let preparedToNetworkSendAttachements : Attachment[] = await prepareAttachmentsToSend(messageId, dialog, key.toString('utf-8'), attachemnts);
if(attachemnts.length <= 0 && message.trim() == ""){
runQuery("UPDATE messages SET delivered = ? WHERE message_id = ?", [DeliveredMessageState.ERROR, messageId]);
updateDialog(dialog);