Фикс ошибки чтения
This commit is contained in:
@@ -295,7 +295,6 @@ export function DialogProvider(props: DialogProviderProps) {
|
|||||||
* Обработчик чтения для личных сообщений
|
* Обработчик чтения для личных сообщений
|
||||||
*/
|
*/
|
||||||
usePacket(0x07, async (packet : PacketRead) => {
|
usePacket(0x07, async (packet : PacketRead) => {
|
||||||
info("Read packet received in dialog provider");
|
|
||||||
const fromPublicKey = packet.getFromPublicKey();
|
const fromPublicKey = packet.getFromPublicKey();
|
||||||
if(fromPublicKey == publicKey){
|
if(fromPublicKey == publicKey){
|
||||||
/**
|
/**
|
||||||
@@ -309,7 +308,10 @@ export function DialogProvider(props: DialogProviderProps) {
|
|||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(fromPublicKey != props.dialog && !idle){
|
if(idle){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(fromPublicKey != props.dialog){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setMessages((prev) => prev.map((msg) => {
|
setMessages((prev) => prev.map((msg) => {
|
||||||
@@ -342,7 +344,10 @@ export function DialogProvider(props: DialogProviderProps) {
|
|||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(toPublicKey != props.dialog && !idle){
|
if(idle){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(toPublicKey != props.dialog){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setMessages((prev) => prev.map((msg) => {
|
setMessages((prev) => prev.map((msg) => {
|
||||||
|
|||||||
@@ -367,13 +367,11 @@ export function useDialogFiber() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await updateSyncTime(Date.now());
|
await updateSyncTime(Date.now());
|
||||||
console.info("PACKED_READ_IM");
|
|
||||||
await runQuery(`UPDATE messages SET read = 1 WHERE from_public_key = ? AND to_public_key = ? AND account = ?`, [toPublicKey, fromPublicKey, publicKey]);
|
await runQuery(`UPDATE messages SET read = 1 WHERE from_public_key = ? AND to_public_key = ? AND account = ?`, [toPublicKey, fromPublicKey, publicKey]);
|
||||||
console.info("read im with params ", [fromPublicKey, toPublicKey, publicKey]);
|
|
||||||
updateDialog(fromPublicKey);
|
updateDialog(fromPublicKey);
|
||||||
log("Read packet received from " + fromPublicKey + " for " + toPublicKey);
|
|
||||||
addOrUpdateDialogCache(fromPublicKey, getDialogCache(fromPublicKey).map((message) => {
|
addOrUpdateDialogCache(fromPublicKey, getDialogCache(fromPublicKey).map((message) => {
|
||||||
if (message.from_public_key == toPublicKey && !message.readed) {
|
if (message.from_public_key == publicKey && !message.readed) {
|
||||||
console.info("Marking message as read in cache for dialog with " + fromPublicKey);
|
console.info("Marking message as read in cache for dialog with " + fromPublicKey);
|
||||||
console.info({ fromPublicKey, toPublicKey });
|
console.info({ fromPublicKey, toPublicKey });
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user