mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: add "receivedInitialSync" connection update
This commit is contained in:
@@ -41,6 +41,9 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
'doing initial app state sync'
|
'doing initial app state sync'
|
||||||
)
|
)
|
||||||
await resyncMainAppState(recvChats)
|
await resyncMainAppState(recvChats)
|
||||||
|
|
||||||
|
const accountSyncCounter = (authState.creds.accountSyncCounter || 0) + 1
|
||||||
|
ev.emit('creds.update', { accountSyncCounter })
|
||||||
} else {
|
} else {
|
||||||
logger.warn('connection closed before app state sync')
|
logger.warn('connection closed before app state sync')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ export type AuthenticationCreds = SignalCreds & {
|
|||||||
platform?: string
|
platform?: string
|
||||||
|
|
||||||
processedHistoryMessages: MinimalMessage[]
|
processedHistoryMessages: MinimalMessage[]
|
||||||
|
/** number of times history & app state has been synced */
|
||||||
|
accountSyncCounter: number
|
||||||
accountSettings: AccountSettings
|
accountSettings: AccountSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,31 +51,27 @@ export type ChatModification =
|
|||||||
{
|
{
|
||||||
archive: boolean
|
archive: boolean
|
||||||
lastMessages: LastMessageList
|
lastMessages: LastMessageList
|
||||||
} |
|
}
|
||||||
{
|
| { pushNameSetting: string }
|
||||||
pushNameSetting: string
|
| { pin: boolean }
|
||||||
} |
|
| {
|
||||||
{
|
|
||||||
pin: boolean
|
|
||||||
} |
|
|
||||||
{
|
|
||||||
/** mute for duration, or provide timestamp of mute to remove*/
|
/** mute for duration, or provide timestamp of mute to remove*/
|
||||||
mute: number | null
|
mute: number | null
|
||||||
} |
|
}
|
||||||
{
|
| {
|
||||||
clear: 'all' | { messages: {id: string, fromMe?: boolean, timestamp: number}[] }
|
clear: 'all' | { messages: {id: string, fromMe?: boolean, timestamp: number}[] }
|
||||||
} |
|
}
|
||||||
{
|
| {
|
||||||
star: {
|
star: {
|
||||||
messages: { id: string, fromMe?: boolean }[],
|
messages: { id: string, fromMe?: boolean }[],
|
||||||
star: boolean
|
star: boolean
|
||||||
}
|
}
|
||||||
} |
|
}
|
||||||
{
|
| {
|
||||||
markRead: boolean
|
markRead: boolean
|
||||||
lastMessages: LastMessageList
|
lastMessages: LastMessageList
|
||||||
} |
|
}
|
||||||
{ delete: true, lastMessages: LastMessageList }
|
| { delete: true, lastMessages: LastMessageList }
|
||||||
|
|
||||||
export type InitialReceivedChatsState = {
|
export type InitialReceivedChatsState = {
|
||||||
[jid: string]: { lastMsgRecvTimestamp: number }
|
[jid: string]: { lastMsgRecvTimestamp: number }
|
||||||
|
|||||||
@@ -85,5 +85,4 @@ export type WABusinessProfile = {
|
|||||||
address?: string
|
address?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export type CurveKeyPair = { private: Uint8Array; public: Uint8Array }
|
export type CurveKeyPair = { private: Uint8Array; public: Uint8Array }
|
||||||
@@ -128,6 +128,7 @@ export const initAuthCreds = (): AuthenticationCreds => {
|
|||||||
processedHistoryMessages: [],
|
processedHistoryMessages: [],
|
||||||
nextPreKeyId: 1,
|
nextPreKeyId: 1,
|
||||||
firstUnuploadedPreKeyId: 1,
|
firstUnuploadedPreKeyId: 1,
|
||||||
|
accountSyncCounter: 0,
|
||||||
accountSettings: {
|
accountSettings: {
|
||||||
unarchiveChats: false
|
unarchiveChats: false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user