mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: resync main app state on first open
This commit is contained in:
@@ -610,6 +610,10 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
fetchPrivacySettings(),
|
fetchPrivacySettings(),
|
||||||
sendPresenceUpdate('available')
|
sendPresenceUpdate('available')
|
||||||
])
|
])
|
||||||
|
if(!authState.creds.didInitialAppStateSync) {
|
||||||
|
await resyncMainAppState()
|
||||||
|
ev.emit('creds.update', { didInitialAppStateSync: true })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ws.on('CB:presence', handlePresenceUpdate)
|
ws.on('CB:presence', handlePresenceUpdate)
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ export type AuthenticationCreds = SignalCreds & {
|
|||||||
|
|
||||||
lastAccountSyncTimestamp?: number
|
lastAccountSyncTimestamp?: number
|
||||||
accountSettings: AccountSettings
|
accountSettings: AccountSettings
|
||||||
|
didInitialAppStateSync: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SignalDataTypeMap = {
|
export type SignalDataTypeMap = {
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ export const initAuthCreds = (): AuthenticationCreds => {
|
|||||||
serverHasPreKeys: false,
|
serverHasPreKeys: false,
|
||||||
accountSettings: {
|
accountSettings: {
|
||||||
unarchiveChats: false
|
unarchiveChats: false
|
||||||
}
|
},
|
||||||
|
didInitialAppStateSync: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user