Sync call link create/update

This commit is contained in:
Jamie Kyle 2024-07-24 14:35:36 -07:00 committed by GitHub
parent 554f5dbe7a
commit 92ca681d3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 19 deletions

View file

@ -7,6 +7,7 @@ import {
} from '@signalapp/ringrtc';
import { Aci } from '@signalapp/libsignal-client';
import { z } from 'zod';
import { v4 as generateUuid } from 'uuid';
import * as RemoteConfig from '../RemoteConfig';
import type { CallLinkAuthCredentialPresentation } from './zkgroup';
import {
@ -31,6 +32,13 @@ import {
import type { LocalizerType } from '../types/Util';
import { isTestOrMockEnvironment } from '../environment';
import { getColorForCallLink } from './getColorForCallLink';
import {
AdhocCallStatus,
CallDirection,
CallType,
type CallHistoryDetails,
} from '../types/CallDisposition';
import { CallMode } from '../types/Calling';
export const CALL_LINK_DEFAULT_STATE = {
name: '',
@ -204,3 +212,18 @@ export function callLinkFromRecord(record: CallLinkRecord): CallLinkType {
expiration: record.expiration,
};
}
export function toCallHistoryFromUnusedCallLink(
callLink: CallLinkType
): CallHistoryDetails {
return {
callId: generateUuid(),
peerId: callLink.roomId,
ringerId: null,
mode: CallMode.Adhoc,
type: CallType.Adhoc,
direction: CallDirection.Incoming,
timestamp: Date.now(),
status: AdhocCallStatus.Pending,
};
}