mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: export resyncmainappstate
This commit is contained in:
@@ -302,6 +302,20 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resyncMainAppState = async() => {
|
||||||
|
|
||||||
|
logger.debug('resyncing main app state')
|
||||||
|
|
||||||
|
await (
|
||||||
|
mutationMutex.mutex(
|
||||||
|
() => resyncAppState([ 'critical_block', 'critical_unblock_low' ])
|
||||||
|
)
|
||||||
|
.catch(err => (
|
||||||
|
logger.warn({ trace: err.stack }, 'failed to sync app state')
|
||||||
|
))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const processSyncActions = (actions: ChatMutation[]) => {
|
const processSyncActions = (actions: ChatMutation[]) => {
|
||||||
const updates: { [jid: string]: Partial<Chat> } = {}
|
const updates: { [jid: string]: Partial<Chat> } = {}
|
||||||
const contactUpdates: { [jid: string]: Contact } = {}
|
const contactUpdates: { [jid: string]: Contact } = {}
|
||||||
@@ -454,14 +468,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
sendPresenceUpdate('available')
|
sendPresenceUpdate('available')
|
||||||
fetchBlocklist()
|
fetchBlocklist()
|
||||||
fetchPrivacySettings()
|
fetchPrivacySettings()
|
||||||
mutationMutex.mutex(
|
resyncMainAppState()
|
||||||
async() => {
|
|
||||||
await (
|
|
||||||
resyncAppState([ 'critical_block', 'critical_unblock_low' ])
|
|
||||||
.catch(err => logger.info({ trace: err.stack }, 'failed to sync app state'))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -478,5 +485,6 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
updateBlockStatus,
|
updateBlockStatus,
|
||||||
resyncAppState,
|
resyncAppState,
|
||||||
chatModify,
|
chatModify,
|
||||||
|
resyncMainAppState,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user