Fix Played Status (message update event) (#1089)

* Fix Played Status

* Update messages-recv.ts

Co-authored-by: Adhiraj Singh <adhirajsingh1001@gmail.com>
This commit is contained in:
rafaelwedbiz
2021-12-29 03:30:35 -03:00
committed by GitHub
parent c561ddcd3b
commit 3534221e11

View File

@@ -7,16 +7,14 @@ import { KEY_BUNDLE_TYPE } from "../Defaults"
import { makeChatsSocket } from "./chats"
import { extractGroupMetadata } from "./groups"
const getStatusFromReceiptType = (type: string | undefined) => {
if(type === 'read' || type === 'read-self') {
return proto.WebMessageInfo.WebMessageInfoStatus.READ
}
if(typeof type === 'undefined') {
return proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK
}
return undefined
const STATUS_MAP: { [_: string]: proto.WebMessageInfo.WebMessageInfoStatus } = {
'played': proto.WebMessageInfo.WebMessageInfoStatus.PLAYED,
'read': proto.WebMessageInfo.WebMessageInfoStatus.READ,
'read-self': proto.WebMessageInfo.WebMessageInfoStatus.READ
}
const getStatusFromReceiptType = (type: string | undefined) => STATUS_MAP[type]
export const makeMessagesRecvSocket = (config: SocketConfig) => {
const { logger } = config
const sock = makeChatsSocket(config)
@@ -606,4 +604,4 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
})
return { ...sock, processMessage, sendMessageAck }
}
}