mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-17 15:23:36 +01:00
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
// Copyright 2023 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import React from 'react';
|
|
|
|
import type { LocalizerType } from '../../types/Util.std.js';
|
|
import { SystemMessage } from './SystemMessage.dom.js';
|
|
import { Emojify } from './Emojify.dom.js';
|
|
import { getStringForPhoneNumberDiscovery } from '../../util/getStringForPhoneNumberDiscovery.std.js';
|
|
import {
|
|
useSharedGroupNamesOnMount,
|
|
type GetSharedGroupNamesType,
|
|
} from '../../util/sharedGroupNames.dom.js';
|
|
|
|
export type PropsDataType = {
|
|
conversationId: string;
|
|
conversationTitle: string;
|
|
phoneNumber: string;
|
|
};
|
|
export type PropsType = PropsDataType & {
|
|
getSharedGroupNames: GetSharedGroupNamesType;
|
|
i18n: LocalizerType;
|
|
};
|
|
|
|
// Also known as a Session Switchover Event (SSE)
|
|
export function PhoneNumberDiscoveryNotification(
|
|
props: PropsType
|
|
): React.JSX.Element {
|
|
const {
|
|
conversationId,
|
|
conversationTitle,
|
|
getSharedGroupNames,
|
|
i18n,
|
|
phoneNumber,
|
|
} = props;
|
|
|
|
const sharedGroupNames = useSharedGroupNamesOnMount(
|
|
conversationId,
|
|
getSharedGroupNames
|
|
);
|
|
const sharedGroup = sharedGroupNames[0];
|
|
|
|
const message = getStringForPhoneNumberDiscovery({
|
|
conversationTitle,
|
|
i18n,
|
|
phoneNumber,
|
|
sharedGroup,
|
|
});
|
|
|
|
return <SystemMessage icon="info" contents={<Emojify text={message} />} />;
|
|
}
|