style: use getAllBinaryNodeChildren

This commit is contained in:
Adhiraj Singh
2021-11-11 11:29:12 +05:30
parent d8c8d46adb
commit 71664756dd
2 changed files with 4 additions and 4 deletions

View File

@@ -190,7 +190,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
participants = message.messageStubParameters
emitParticipantsUpdate('remove')
// mark the chat read only if you left the group
if (participants.includes(meJid)) {
if(participants.includes(meJid)) {
chatUpdate.readOnly = true
}
break
@@ -261,7 +261,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
const processNotification = (node: BinaryNode): Partial<proto.IWebMessageInfo> => {
const result: Partial<proto.IWebMessageInfo> = { }
const child = (node.content as BinaryNode[])?.[0]
const [child] = getAllBinaryNodeChildren(node)
if(node.attrs.type === 'w:gp2') {
switch(child?.tag) {

View File

@@ -4,7 +4,7 @@ import { proto } from '../../WAProto'
import type { AuthenticationState, SocketConfig, SignalKeyStore, AuthenticationCreds, KeyPair, LTHashState } from "../Types"
import { Curve, hmacSign, signedKeyPair } from './crypto'
import { encodeInt, generateRegistrationId } from './generics'
import { BinaryNode, S_WHATSAPP_NET, jidDecode, Binary } from '../WABinary'
import { BinaryNode, S_WHATSAPP_NET, jidDecode, Binary, getAllBinaryNodeChildren } from '../WABinary'
import { createSignalIdentity } from './signal'
const ENCODED_VERSION = 'S9Kdc4pc4EJryo21snc5cg=='
@@ -164,7 +164,7 @@ export const configureSuccessfulPairing = (
stanza: BinaryNode,
{ advSecretKey, signedIdentityKey, signalIdentities }: Pick<AuthenticationCreds, 'advSecretKey' | 'signedIdentityKey' | 'signalIdentities'>
) => {
const pair = stanza.content[0] as BinaryNode
const [pair] = getAllBinaryNodeChildren(stanza)
const pairContent = Array.isArray(pair.content) ? pair.content : []
const msgId = stanza.attrs.id