Update CallLogEvent to latest spec

This commit is contained in:
Jamie Kyle 2024-06-25 17:58:38 -07:00 committed by GitHub
parent 815fd77849
commit fc08e70c0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 366 additions and 142 deletions

View file

@ -26,6 +26,7 @@ export enum CallDirection {
export enum CallLogEvent {
Clear = 'Clear',
MarkedAsRead = 'MarkedAsRead',
MarkedAsReadInConversation = 'MarkedAsReadInConversation',
}
export enum LocalCallEvent {
@ -97,6 +98,19 @@ export type CallDetails = Readonly<{
timestamp: number;
}>;
export type CallLogEventTarget = Readonly<{
timestamp: number;
callId: string | null;
peerId: AciString | string | null;
}>;
export type CallLogEventDetails = Readonly<{
type: CallLogEvent;
timestamp: number;
peerId: AciString | string | null;
callId: string | null;
}>;
export type CallEventDetails = CallDetails &
Readonly<{
event: CallEvent;
@ -221,6 +235,13 @@ export const callEventNormalizeSchema = z.object({
event: z.nativeEnum(Proto.SyncMessage.CallEvent.Event),
});
export const callLogEventNormalizeSchema = z.object({
type: z.nativeEnum(Proto.SyncMessage.CallLogEvent.Type),
timestamp: longToNumberSchema,
peerId: peerIdInBytesSchema.optional(),
callId: longToStringSchema.optional(),
});
export function isSameCallHistoryGroup(
a: CallHistoryGroup,
b: CallHistoryGroup