feat: more accurately handle app state sync

This commit is contained in:
Adhiraj Singh
2022-06-11 12:02:08 +05:30
parent 79518787b6
commit 5cb71ac862
7 changed files with 290 additions and 30 deletions

View File

@@ -1,10 +1,19 @@
import type { proto } from '../../WAProto'
import type { AccountSettings } from './Auth'
import type { MinimalMessage } from './Message'
/** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused'
export type WAPatchName = 'critical_block' | 'critical_unblock_low' | 'regular_low' | 'regular_high' | 'regular'
export const ALL_WA_PATCH_NAMES = [
'critical_block',
'critical_unblock_low',
'regular_high',
'regular_low',
'regular'
] as const
export type WAPatchName = typeof ALL_WA_PATCH_NAMES[number]
export interface PresenceData {
lastKnownPresence: WAPresence
@@ -65,4 +74,14 @@ export type ChatModification =
markRead: boolean
lastMessages: LastMessageList
} |
{ delete: true, lastMessages: LastMessageList }
{ delete: true, lastMessages: LastMessageList }
export type InitialReceivedChatsState = {
[jid: string]: { lastMsgRecvTimestamp: number }
}
export type InitialAppStateSyncOptions = {
recvChats: InitialReceivedChatsState
accountSettings: AccountSettings
}