From 012a561471f14aaa3d0016253999a9adcaa04044 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Sun, 1 Feb 2026 01:07:29 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=D0=A1=D0=B8=D0=BD=D1=85=D1=80=D0=BE=D0=BD?= =?UTF-8?q?=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D1=87=D1=82=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BB=D0=B8=D1=87=D0=BD=D1=8B=D1=85=20=D1=81?= =?UTF-8?q?=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DialogProvider/useDialogFiber.ts | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/app/providers/DialogProvider/useDialogFiber.ts b/app/providers/DialogProvider/useDialogFiber.ts index 8daa29a..de5a59f 100644 --- a/app/providers/DialogProvider/useDialogFiber.ts +++ b/app/providers/DialogProvider/useDialogFiber.ts @@ -425,6 +425,43 @@ export function useDialogFiber() { } }, [blocked, muted, updateDialog, focused, currentDialogPublicKeyView, viewState, idle]); + /** + * Обработчик синхронизации прочтения личных сообщений + */ + usePacket(0x07, async (packet: PacketRead) => { + if(hasGroup(packet.getToPublicKey())){ + /** + * Если это относится к группам, то игнорируем здесь, + * для этого есть отдельный слушатель usePacket ниже + */ + return; + } + const fromPublicKey = packet.getFromPublicKey(); + if(fromPublicKey != publicKey){ + /** + * Игнорируем если это не наше прочтение + */ + return; + } + + const toPublicKey = packet.getToPublicKey(); + await runQuery(`UPDATE messages SET read = 1 WHERE from_public_key = ? AND to_public_key = ? AND account = ?`, + [fromPublicKey, toPublicKey, publicKey]); + updateDialog(toPublicKey); + log("Read sync packet from other device"); + addOrUpdateDialogCache(fromPublicKey, getDialogCache(fromPublicKey).map((message) => { + if (message.from_public_key == toPublicKey && !message.readed) { + console.info("Marking message as read in cache for dialog with " + fromPublicKey); + console.info({fromPublicKey, toPublicKey}); + return { + ...message, + readed: 1 + } + } + return message; + })); + }, [updateDialog]); + /** * Обработчик прочтения личных сообщений */ From 22dd15be0086e1d1e9229c5b47d0ef6a58631170 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Sun, 1 Feb 2026 01:07:58 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8?= =?UTF-8?q?=20=D1=81=20=D1=86=D0=B8=D0=BA=D0=BB=D0=B8=D1=87=D0=BD=D1=8B?= =?UTF-8?q?=D0=BC=20=D1=80=D0=B5=D0=BA=D0=BE=D0=BD=D0=BD=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D0=BC=20=D0=B8=D0=B7-=D0=B7=D0=B0=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B5=D0=BB=D0=BE=D1=87=D0=BD=D0=BE=D0=B9=20=D1=84=D1=83=D0=BD?= =?UTF-8?q?=D0=BA=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/providers/ProtocolProvider/protocol/protocol.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/providers/ProtocolProvider/protocol/protocol.ts b/app/providers/ProtocolProvider/protocol/protocol.ts index a6ea06a..aa951f5 100644 --- a/app/providers/ProtocolProvider/protocol/protocol.ts +++ b/app/providers/ProtocolProvider/protocol/protocol.ts @@ -52,13 +52,13 @@ export default class Protocol extends EventEmitter { _this.emit('handshake_complete'); _this.handshakeExchangeComplete = true; _this._flushPacketQueue(); - this.startHeartbeat(packet.getHeartbeatInterval()); + _this.startHeartbeat(packet.getHeartbeatInterval()); } if(packet.getHandshakeState() == HandshakeState.NEED_DEVICE_VERIFICATION) { console.info('[protocol] %chandshake exchange need device verification', 'color: orange;'); _this.emit('handshake_need_device_verification'); _this._packetQueue = []; - this.startHeartbeat(packet.getHeartbeatInterval()); + _this.startHeartbeat(packet.getHeartbeatInterval()); } });