diff --git a/app/providers/DialogProvider/useDialogFiber.ts b/app/providers/DialogProvider/useDialogFiber.ts index c8f7b9e..2c372aa 100644 --- a/app/providers/DialogProvider/useDialogFiber.ts +++ b/app/providers/DialogProvider/useDialogFiber.ts @@ -62,6 +62,8 @@ export function useDialogFiber() { /** * Нам приходят сообщения от себя самих же при синхронизации * нужно обрабатывать их особым образом соотвественно + * + * Метод нужен для синхронизации своих сообщений */ usePacket(0x06, async (packet: PacketMessage) => { const fromPublicKey = packet.getFromPublicKey(); @@ -78,7 +80,6 @@ export function useDialogFiber() { */ return; } - const chachaDecryptedKey = Buffer.from(await decodeWithPassword(privatePlain, aesChachaKey), "binary"); const key = chachaDecryptedKey.slice(0, 32); const nonce = chachaDecryptedKey.slice(32); @@ -118,9 +119,9 @@ export function useDialogFiber() { to_public_key: toPublicKey, content: content, timestamp: timestamp, - readed: idle ? 0 : 1, + readed: 1, //сообщение прочитано chacha_key: chachaDecryptedKey.toString('utf-8'), - from_me: fromPublicKey == publicKey ? 1 : 0, + from_me: 1, //сообщение от нас plain_message: (decryptedContent as string), delivered: DeliveredMessageState.DELIVERED, message_id: messageId, @@ -134,16 +135,16 @@ export function useDialogFiber() { toPublicKey, content, timestamp, - (currentDialogPublicKeyView == fromPublicKey && !idle && viewState != ViewPanelsState.DIALOGS_PANEL_ONLY) ? 1 : 0, + 0, //по умолчанию не прочитаны '', - 0, + 1, //Свои же сообщения всегда от нас await encodeWithPassword(privatePlain, decryptedContent), publicKey, messageId, DeliveredMessageState.DELIVERED, JSON.stringify(attachmentsMeta)]); - updateDialog(fromPublicKey); + updateDialog(toPublicKey); let dialogCache = getDialogCache(toPublicKey); if (currentDialogPublicKeyView !== toPublicKey && dialogCache.length > 0) {