Files
Desktop/ts/util/getE164.std.ts
Fedor Indutny 44076ece79 Rename files
2025-10-16 23:45:44 -07:00

28 lines
746 B
TypeScript

// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ConversationAttributesType } from '../model-types.d.ts';
import type { ConversationType } from '../state/ducks/conversations.preload.js';
import { isInSystemContacts } from './isInSystemContacts.std.js';
export function getE164(
attributes: Pick<
ConversationAttributesType | ConversationType,
| 'type'
| 'name'
| 'systemGivenName'
| 'systemFamilyName'
| 'e164'
| 'sharingPhoneNumber'
| 'profileKey'
>
): string | undefined {
const { e164, profileKey, sharingPhoneNumber } = attributes;
if (!sharingPhoneNumber && profileKey && !isInSystemContacts(attributes)) {
return undefined;
}
return e164;
}