Change Phone Number notifications

This commit is contained in:
Fedor Indutny 2021-08-05 16:34:49 -07:00 committed by GitHub
parent 4b82ac387b
commit a001882d58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 277 additions and 39 deletions

View file

@ -13,6 +13,7 @@ import {
import { TimelineItemType } from '../../components/conversation/TimelineItem';
import { PropsData } from '../../components/conversation/Message';
import { PropsData as TimerNotificationProps } from '../../components/conversation/TimerNotification';
import { PropsData as ChangeNumberNotificationProps } from '../../components/conversation/ChangeNumberNotification';
import { PropsData as SafetyNumberNotificationProps } from '../../components/conversation/SafetyNumberNotification';
import { PropsData as VerificationNotificationProps } from '../../components/conversation/VerificationNotification';
import { PropsDataType as GroupsV2Props } from '../../components/conversation/GroupV2Change';
@ -188,6 +189,12 @@ export function getPropsForBubble(
data: null,
};
}
if (isChangeNumberNotification(message)) {
return {
type: 'changeNumberNotification',
data: getPropsForChangeNumberNotification(message, conversationSelector),
};
}
if (isChatSessionRefreshed(message)) {
return {
type: 'chatSessionRefreshed',
@ -852,6 +859,24 @@ export function isUniversalTimerNotification(
return message.type === 'universal-timer-notification';
}
// Change Number Notification
export function isChangeNumberNotification(
message: MessageAttributesType
): boolean {
return message.type === 'change-number-notification';
}
function getPropsForChangeNumberNotification(
message: MessageAttributesType,
conversationSelector: GetConversationByIdType
): ChangeNumberNotificationProps {
return {
sender: conversationSelector(message.sourceUuid),
timestamp: message.sent_at,
};
}
// Chat Session Refreshed
export function isChatSessionRefreshed(