Support phone number sharing flag on profile
This commit is contained in:
parent
23f39a0dc7
commit
d71da5c486
16 changed files with 155 additions and 33 deletions
26
ts/util/getE164.ts
Normal file
26
ts/util/getE164.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2023 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { ConversationAttributesType } from '../model-types.d';
|
||||
import type { ConversationType } from '../state/ducks/conversations';
|
||||
import { isInSystemContacts } from './isInSystemContacts';
|
||||
|
||||
export function getE164(
|
||||
attributes: Pick<
|
||||
ConversationAttributesType | ConversationType,
|
||||
| 'type'
|
||||
| 'name'
|
||||
| 'systemGivenName'
|
||||
| 'systemFamilyName'
|
||||
| 'e164'
|
||||
| 'notSharingPhoneNumber'
|
||||
>
|
||||
): string | undefined {
|
||||
const { e164, notSharingPhoneNumber = false } = attributes;
|
||||
|
||||
if (notSharingPhoneNumber && !isInSystemContacts(attributes)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return e164;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue