From d6065015e6018c03ede2cee3fb48c8be0f38a774 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Mon, 7 Mar 2022 09:07:38 +0530 Subject: [PATCH] chore: move messages-recv utils to the bottom of file --- src/Socket/messages-recv.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index 5ad9abf..4ea2098 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -8,21 +8,6 @@ import { areJidsSameUser, BinaryNode, BinaryNodeAttributes, getAllBinaryNodeChil import { makeChatsSocket } from './chats' import { extractGroupMetadata } from './groups' -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) => { - const status = STATUS_MAP[type] - if(typeof type === 'undefined') { - return proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK - } - - return status -} - export const makeMessagesRecvSocket = (config: SocketConfig) => { const { logger } = config const sock = makeChatsSocket(config) @@ -571,3 +556,18 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { return { ...sock, processMessage, sendMessageAck, sendRetryRequest } } + +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) => { + const status = STATUS_MAP[type] + if(typeof type === 'undefined') { + return proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK + } + + return status +}