chore: expose admintest + cleaner initial state update

This commit is contained in:
Adhiraj Singh
2021-12-19 14:48:09 +05:30
parent 9d7aec11da
commit 61d1300dae
2 changed files with 3 additions and 8 deletions

View File

@@ -30,9 +30,7 @@ const makeAuthSocket = (config: LegacySocketConfig) => {
let initTimeout: NodeJS.Timeout
ws.on('phone-connection', ({ value: phoneConnected }) => {
if(phoneConnected !== state.legacy.phoneConnected) {
updateState({ legacy: { ...state.legacy, phoneConnected } })
}
updateState({ legacy: { ...state.legacy, phoneConnected } })
})
// add close listener
ws.on('ws-close', (error: Boom | Error) => {
@@ -222,11 +220,7 @@ const makeAuthSocket = (config: LegacySocketConfig) => {
process.nextTick(() => {
ev.emit('connection.update', {
connection: 'connecting',
receivedPendingNotifications: false,
legacy: {
phoneConnected: false
}
...state
})
})

View File

@@ -365,6 +365,7 @@ export const makeSocket = ({
return {
type: 'legacy' as 'legacy',
ws,
sendAdminTest,
updateKeys: (info: { encKey: Buffer, macKey: Buffer }) => authInfo = info,
waitForSocketOpen,
sendNode,