feat(labels): modify chat utils

This commit is contained in:
Rafael Garcia
2023-05-14 12:44:19 -05:00
parent 00a7b48749
commit 38f285760d
4 changed files with 362 additions and 208 deletions

View File

@@ -1,6 +1,8 @@
import type { proto } from '../../WAProto'
import type { AccountSettings } from './Auth'
import type { BufferedEventData } from './Events'
import type { ChatLabelAssociationActionBody } from './LabelAssociation'
import type { MessageLabelAssociationActionBody } from './LabelAssociation'
import type { MinimalMessage } from './Message'
/** privacy settings in WhatsApp Web */
@@ -14,11 +16,11 @@ export type WAReadReceiptsValue = 'all' | 'none'
export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused'
export const ALL_WA_PATCH_NAMES = [
'critical_block',
'critical_unblock_low',
'regular_high',
'regular_low',
'regular'
'critical_block',
'critical_unblock_low',
'regular_high',
'regular_low',
'regular'
] as const
export type WAPatchName = typeof ALL_WA_PATCH_NAMES[number]
@@ -77,7 +79,7 @@ export type ChatModification =
mute: number | null
}
| {
clear: 'all' | { messages: {id: string, fromMe?: boolean, timestamp: number}[] }
clear: 'all' | { messages: { id: string, fromMe?: boolean, timestamp: number }[] }
}
| {
star: {
@@ -90,6 +92,11 @@ export type ChatModification =
lastMessages: LastMessageList
}
| { delete: true, lastMessages: LastMessageList }
// Label assosiation
| { addChatLabel: ChatLabelAssociationActionBody }
| { removeChatLabel: ChatLabelAssociationActionBody }
| { addMessageLabel: MessageLabelAssociationActionBody }
| { removeMessageLabel: MessageLabelAssociationActionBody }
export type InitialReceivedChatsState = {
[jid: string]: {