From 2b10b7b18f8c21da83222a4a6bff0bfabaeb9bae Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Mon, 14 Mar 2022 19:38:01 +0530 Subject: [PATCH] chore: minor code cleanup --- src/Defaults/index.ts | 2 +- src/Socket/chats.ts | 7 ++++--- src/Socket/socket.ts | 2 +- src/Utils/validate-connection.ts | 6 +++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Defaults/index.ts b/src/Defaults/index.ts index 06ea237..1c55f67 100644 --- a/src/Defaults/index.ts +++ b/src/Defaults/index.ts @@ -57,4 +57,4 @@ export const MEDIA_PATH_MAP: { [T in MediaType]: string } = { export const MEDIA_KEYS = Object.keys(MEDIA_PATH_MAP) as MediaType[] -export const KEY_BUNDLE_TYPE = '' +export const KEY_BUNDLE_TYPE = Buffer.from([5]) diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index 5b30f43..3e9c45e 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -680,11 +680,12 @@ export const makeChatsSocket = (config: SocketConfig) => { ev.on('connection.update', ({ connection }) => { if(connection === 'open') { - sendPresenceUpdate('available') - fetchBlocklist() - fetchPrivacySettings() fetchAbt() fetchProps() + fetchBlocklist() + fetchPrivacySettings() + + sendPresenceUpdate('available') } }) diff --git a/src/Socket/socket.ts b/src/Socket/socket.ts index 1d3df07..6303eb7 100644 --- a/src/Socket/socket.ts +++ b/src/Socket/socket.ts @@ -401,7 +401,7 @@ export const makeSocket = ({ { tag: 'remove-companion-device', attrs: { - jid: jid, + jid, reason: 'user_initiated' } } diff --git a/src/Utils/validate-connection.ts b/src/Utils/validate-connection.ts index 3ba48dc..9f36622 100644 --- a/src/Utils/validate-connection.ts +++ b/src/Utils/validate-connection.ts @@ -139,7 +139,11 @@ export const configureSuccessfulPairing = ( tag: 'pair-device-sign', attrs: { }, content: [ - { tag: 'device-identity', attrs: { 'key-index': `${keyIndex}` }, content: accountEnc } + { + tag: 'device-identity', + attrs: { 'key-index': `${keyIndex}` }, + content: accountEnc + } ] } ]